@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
36 lines (35 loc) • 2.06 kB
TypeScript
import { EditorState, EditorView, TextSelection, Transaction } from '../prosemirror';
export * from '../prosemirror/prosemirror-commands';
export declare function toggleBlockType(view: EditorView, name: string): boolean;
export declare function setNormalText(): Command;
export declare function toggleHeading(level: number): Command;
/**
* Sometimes a selection in the editor can be slightly offset, for example:
* it's possible for a selection to start or end at an empty node at the very end of
* a line. This isn't obvious by looking at the editor and it's likely not what the
* user intended - so we need to adjust the seletion a bit in scenarios like that.
*/
export declare function adjustSelectionInList(doc: any, selection: TextSelection): TextSelection;
export declare function preventDefault(): Command;
export declare function toggleList(listType: 'bulletList' | 'orderedList'): Command;
export declare function toggleBulletList(): Command;
export declare function toggleOrderedList(): Command;
export declare function wrapInList(nodeType: any): Command;
export declare function liftListItems(): Command;
export declare function insertBlockType(view: EditorView, name: string): boolean;
/**
* Function will insert code block at current selection if block is empty or below current selection and set focus on it.
*/
export declare function insertCodeBlock(): Command;
export declare function createCodeBlockFromFenceFormat(): Command;
export declare function showLinkPanel(): Command;
export declare function insertNewLine(): Command;
export declare function insertRule(): Command;
export declare function indentList(): Command;
export declare function outdentList(): Command;
export declare function createNewParagraphAbove(view: EditorView): Command;
export declare function createNewParagraphBelow(view: EditorView): Command;
export declare function createParagraphNear(view: EditorView, append?: boolean): void;
export interface Command {
(state: EditorState<any>, dispatch: (tr: Transaction) => void, view?: EditorView): boolean;
}