slate

Search for an npm package

slate

module "slate" {
export const apply: WithEditorFirstArg<Editor["apply"]> = ...
Unexported symbols referenced here
type WithEditorFirstArg<T extends (...args: any) => any> = (editor: Editor, ...args: Parameters<T>) => ReturnType<T>
Referenced by

Get the "dirty" paths generated from an operation.

export const getDirtyPaths: WithEditorFirstArg<Editor["getDirtyPaths"]> = ...
export const getFragment: WithEditorFirstArg<Editor["getFragment"]> = ...
export const normalizeNode: WithEditorFirstArg<Editor["normalizeNode"]> = ...
export const shouldNormalize: WithEditorFirstArg<Editor["shouldNormalize"]> = ...

Create a new Slate Editor object.

export const createEditor: () => Editor = ...
export const above: EditorInterface["above"] = ...
export const addMark: EditorInterface["addMark"] = ...
export const after: EditorInterface["after"] = ...
export const before: EditorInterface["before"] = ...
export const deleteBackward: WithEditorFirstArg<Editor["deleteBackward"]> = ...
export const deleteForward: WithEditorFirstArg<Editor["deleteForward"]> = ...
export const deleteFragment: EditorInterface["deleteFragment"] = ...
export const edges: EditorInterface["edges"] = ...
export const elementReadOnly: EditorInterface["elementReadOnly"] = ...
export const end: EditorInterface["end"] = ...
export const first: EditorInterface["first"] = ...
export const fragment: EditorInterface["fragment"] = ...
export const getVoid: EditorInterface["void"] = ...
export const hasBlocks: EditorInterface["hasBlocks"] = ...
export const hasInlines: EditorInterface["hasInlines"] = ...
export const hasPath: EditorInterface["hasPath"] = ...
export const hasTexts: EditorInterface["hasTexts"] = ...
export const insertBreak: EditorInterface["insertBreak"] = ...
export const insertNode: EditorInterface["insertNode"] = ...
export const insertSoftBreak: EditorInterface["insertSoftBreak"] = ...
export const insertText: EditorInterface["insertText"] = ...
export const isBlock: EditorInterface["isBlock"] = ...
export const isEdge: EditorInterface["isEdge"] = ...
export const isEditor: EditorInterface["isEditor"] = ...
export const isEmpty: EditorInterface["isEmpty"] = ...
export const isEnd: EditorInterface["isEnd"] = ...
export const isNormalizing: EditorInterface["isNormalizing"] = ...
export const isStart: EditorInterface["isStart"] = ...
export const last: EditorInterface["last"] = ...
export const leaf: EditorInterface["leaf"] = ...
export function levels<T extends Node>(editor: Editor, options?: EditorLevelsOptions<T>): Generator<NodeEntry<T>, void, undefined>
export const marks: EditorInterface["marks"] = ...
export const next: EditorInterface["next"] = ...
export const node: EditorInterface["node"] = ...
export function nodes<T extends Node>(editor: Editor, options?: EditorNodesOptions<T>): Generator<NodeEntry<T>, void, undefined>
export const normalize: EditorInterface["normalize"] = ...
export const parent: EditorInterface["parent"] = ...
export const pathRef: EditorInterface["pathRef"] = ...
export const pathRefs: EditorInterface["pathRefs"] = ...
export const path: EditorInterface["path"] = ...
export const pointRef: EditorInterface["pointRef"] = ...
export const pointRefs: EditorInterface["pointRefs"] = ...
export const point: EditorInterface["point"] = ...
export function positions(editor: Editor, options?: EditorPositionsOptions): Generator<Point, void, undefined>
export const previous: EditorInterface["previous"] = ...
export const rangeRef: EditorInterface["rangeRef"] = ...
export const rangeRefs: EditorInterface["rangeRefs"] = ...
export const range: EditorInterface["range"] = ...
export const removeMark: EditorInterface["removeMark"] = ...
export const setNormalizing: EditorInterface["setNormalizing"] = ...
export const start: EditorInterface["start"] = ...
export const string: EditorInterface["string"] = ...
export const unhangRange: EditorInterface["unhangRange"] = ...
export const withoutNormalizing: EditorInterface["withoutNormalizing"] = ...
export const shouldMergeNodesRemovePrevNode: EditorInterface["shouldMergeNodesRemovePrevNode"] = ...

The Editor interface stores all the state of a Slate editor. It is extended by plugins that wish to add their own helpers and implement new behaviors.

export interface BaseEditor {
children: Descendant[];
selection: Selection;
operations: Operation[];
marks: EditorMarks | null;
apply: (operation: Operation) => void;
getDirtyPaths: (operation: Operation) => Path[];
getFragment: () => Descendant[];
isElementReadOnly: (element: Element) => boolean;
isSelectable: (element: Element) => boolean;
markableVoid: (element: Element) => boolean;
normalizeNode: (entry: NodeEntry, options?: {
operation?: Operation;
}) => void;
onChange: (options?: {
operation?: Operation;
}) => void;
shouldNormalize: ({ iteration, dirtyPaths, operation, }: {
iteration: number;
initialDirtyPathsLength: number;
dirtyPaths: Path[];
operation?: Operation;
}) => boolean;
addMark: OmitFirstArg<typeof addMark>;
collapse: OmitFirstArg<typeof Transforms.collapse>;
delete: OmitFirstArg<typeof Transforms.delete>;
deleteBackward: (unit: TextUnit) => void;
deleteForward: (unit: TextUnit) => void;
deleteFragment: OmitFirstArg<typeof deleteFragment>;
deselect: OmitFirstArg<typeof Transforms.deselect>;
insertBreak: OmitFirstArg<typeof insertBreak>;
insertFragment: OmitFirstArg<typeof Transforms.insertFragment>;
insertNode: OmitFirstArg<typeof insertNode>;
insertNodes: OmitFirstArg<typeof Transforms.insertNodes>;
insertSoftBreak: OmitFirstArg<typeof insertSoftBreak>;
insertText: OmitFirstArg<typeof Transforms.insertText>;
liftNodes: OmitFirstArg<typeof Transforms.liftNodes>;
mergeNodes: OmitFirstArg<typeof Transforms.mergeNodes>;
move: OmitFirstArg<typeof Transforms.move>;
moveNodes: OmitFirstArg<typeof Transforms.moveNodes>;
normalize: OmitFirstArg<typeof normalize>;
removeMark: OmitFirstArg<typeof removeMark>;
removeNodes: OmitFirstArg<typeof Transforms.removeNodes>;
select: OmitFirstArg<typeof Transforms.select>;
setNodes: <T extends Node>(props: Partial<T>, options?: {
at?: Location;
match?: NodeMatch<T>;
mode?: MaximizeMode;
hanging?: boolean;
split?: boolean;
voids?: boolean;
compare?: PropsCompare;
merge?: PropsMerge;
}) => void;
setNormalizing: OmitFirstArg<typeof setNormalizing>;
setPoint: OmitFirstArg<typeof Transforms.setPoint>;
setSelection: OmitFirstArg<typeof Transforms.setSelection>;
splitNodes: OmitFirstArg<typeof Transforms.splitNodes>;
unsetNodes: OmitFirstArg<typeof Transforms.unsetNodes>;
unwrapNodes: OmitFirstArg<typeof Transforms.unwrapNodes>;
withoutNormalizing: OmitFirstArg<typeof withoutNormalizing>;
wrapNodes: OmitFirstArg<typeof Transforms.wrapNodes>;
above: <T extends Ancestor>(options?: EditorAboveOptions<T>) => NodeEntry<T> | undefined;
after: OmitFirstArg<typeof after>;
before: OmitFirstArg<typeof before>;
edges: OmitFirstArg<typeof edges>;
elementReadOnly: OmitFirstArg<typeof elementReadOnly>;
end: OmitFirstArg<typeof end>;
first: OmitFirstArg<typeof first>;
fragment: OmitFirstArg<typeof fragment>;
getMarks: OmitFirstArg<typeof marks>;
hasBlocks: OmitFirstArg<typeof hasBlocks>;
hasInlines: OmitFirstArg<typeof hasInlines>;
hasPath: OmitFirstArg<typeof hasPath>;
hasTexts: OmitFirstArg<typeof hasTexts>;
isBlock: OmitFirstArg<typeof isBlock>;
isEdge: OmitFirstArg<typeof isEdge>;
isEmpty: OmitFirstArg<typeof isEmpty>;
isEnd: OmitFirstArg<typeof isEnd>;
isInline: OmitFirstArg<typeof isInline>;
isNormalizing: OmitFirstArg<typeof isNormalizing>;
isStart: OmitFirstArg<typeof isStart>;
isVoid: OmitFirstArg<typeof isVoid>;
last: OmitFirstArg<typeof last>;
leaf: OmitFirstArg<typeof leaf>;
levels: <T extends Node>(options?: EditorLevelsOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
next: <T extends Descendant>(options?: EditorNextOptions<T>) => NodeEntry<T> | undefined;
node: OmitFirstArg<typeof node>;
nodes: <T extends Node>(options?: EditorNodesOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
parent: OmitFirstArg<typeof parent>;
path: OmitFirstArg<typeof path>;
pathRef: OmitFirstArg<typeof pathRef>;
pathRefs: OmitFirstArg<typeof pathRefs>;
point: OmitFirstArg<typeof point>;
pointRef: OmitFirstArg<typeof pointRef>;
pointRefs: OmitFirstArg<typeof pointRefs>;
positions: OmitFirstArg<typeof positions>;
previous: <T extends Node>(options?: EditorPreviousOptions<T>) => NodeEntry<T> | undefined;
range: OmitFirstArg<typeof range>;
rangeRef: OmitFirstArg<typeof rangeRef>;
rangeRefs: OmitFirstArg<typeof rangeRefs>;
start: OmitFirstArg<typeof start>;
string: OmitFirstArg<typeof string>;
unhangRange: OmitFirstArg<typeof unhangRange>;
void: OmitFirstArg<typeof void>;
shouldMergeNodesRemovePrevNode: OmitFirstArg<typeof shouldMergeNodesRemovePrevNode>;
}
Referenced by
Unexported symbols referenced here
type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never
Referenced by

Add a custom property to the leaf text nodes in the current selection.

more
less

If the selection is currently collapsed, the marks will be added to the editor.marks property instead, and applied when text is inserted next.

const addMark: (editor: Editor, key: string, value: any) => void = ...
Referenced by

Delete the content in the current selection.

const deleteFragment: (editor: Editor, options?: EditorFragmentDeletionOptions) => void = ...
Referenced by

Insert a block break at the current selection.

more
less

If the selection is currently expanded, it will be deleted first.

const insertBreak: (editor: Editor) => void = ...
Referenced by

Atomically inserts nodes at the specified location or (if not defined) the current selection or (if not defined) the end of the document.

const insertNode: <T extends Node>(editor: Editor, node: Node, options?: NodeInsertNodesOptions<T>) => void = ...
Referenced by

Insert a soft break at the current selection.

more
less

If the selection is currently expanded, it will be deleted first.

const insertSoftBreak: (editor: Editor) => void = ...
Referenced by

Normalize any dirty objects in the editor.

const normalize: (editor: Editor, options?: EditorNormalizeOptions) => void = ...
Referenced by

Remove a custom property from all of the leaf text nodes in the current selection.

more
less

If the selection is currently collapsed, the removal will be stored on editor.marks and applied to the text inserted next.

const removeMark: (editor: Editor, key: string) => void = ...
Referenced by

Manually set if the editor should currently be normalizing.

more
less

Note: Using this incorrectly can leave the editor in an invalid state.

const setNormalizing: (editor: Editor, isNormalizing: boolean) => void = ...
Referenced by

Call a function, deferring normalization until after it completes.

const withoutNormalizing: (editor: Editor, fn: () => void) => void = ...
Referenced by

Get the point after a location.

const after: (editor: Editor, at: Location, options?: EditorAfterOptions) => Point | undefined = ...
Referenced by

Get the point before a location.

const before: (editor: Editor, at: Location, options?: EditorBeforeOptions) => Point | undefined = ...
Referenced by

Get the start and end points of a location.

const edges: (editor: Editor, at: Location) => [Point, Point] = ...
Referenced by

Match a read-only element in the current branch of the editor.

const elementReadOnly: (editor: Editor, options?: EditorElementReadOnlyOptions) => NodeEntry<Element> | undefined = ...
Referenced by

Get the end point of a location.

const end: (editor: Editor, at: Location) => Point = ...
Referenced by

Get the first node at a location.

const first: (editor: Editor, at: Location) => NodeEntry = ...
Referenced by

Get the fragment at a location.

const fragment: (editor: Editor, at: Location) => Descendant[] = ...
Referenced by

Get the marks that would be added to text at the current selection.

const marks: (editor: Editor) => Omit<Text, "text"> | null = ...
Referenced by

Check if a node has block children.

const hasBlocks: (editor: Editor, element: Element) => boolean = ...
Referenced by

Check if a node has inline and text children.

const hasInlines: (editor: Editor, element: Element) => boolean = ...
Referenced by
const hasPath: (editor: Editor, path: Path) => boolean = ...
Referenced by

Check if a node has text children.

const hasTexts: (editor: Editor, element: Element) => boolean = ...
Referenced by

Check if a value is a block Element object.

const isBlock: (editor: Editor, value: Element) => boolean = ...
Referenced by

Check if a point is an edge of a location.

const isEdge: (editor: Editor, point: Point, at: Location) => boolean = ...
Referenced by

Check if an element is empty, accounting for void nodes.

const isEmpty: (editor: Editor, element: Element) => boolean = ...
Referenced by

Check if a point is the end point of a location.

const isEnd: (editor: Editor, point: Point, at: Location) => boolean = ...
Referenced by

Check if a value is an inline Element object.

const isInline: (editor: Editor, value: Element) => boolean = ...
Referenced by

Check if the editor is currently normalizing after each operation.

const isNormalizing: (editor: Editor) => boolean = ...
Referenced by

Check if a point is the start point of a location.

const isStart: (editor: Editor, point: Point, at: Location) => boolean = ...
Referenced by

Check if a value is a void Element object.

const isVoid: (editor: Editor, value: Element) => boolean = ...
Referenced by

Get the last node at a location.

const last: (editor: Editor, at: Location) => NodeEntry = ...
Referenced by

Get the leaf text node at a location.

const leaf: (editor: Editor, at: Location, options?: EditorLeafOptions) => NodeEntry<Text> = ...
Referenced by

Get the node at a location.

const node: (editor: Editor, at: Location, options?: EditorNodeOptions) => NodeEntry = ...
Referenced by

Get the parent node of a location.

const parent: (editor: Editor, at: Location, options?: EditorParentOptions) => NodeEntry<Ancestor> = ...
Referenced by

Get the path of a location.

const path: (editor: Editor, at: Location, options?: EditorPathOptions) => Path = ...
Referenced by

Create a mutable ref for a Path object, which will stay in sync as new operations are applied to the editor.

const pathRef: (editor: Editor, path: Path, options?: EditorPathRefOptions) => PathRef = ...
Referenced by

Get the set of currently tracked path refs of the editor.

const pathRefs: (editor: Editor) => Set<PathRef> = ...
Referenced by

Get the start or end point of a location.

const point: (editor: Editor, at: Location, options?: EditorPointOptions) => Point = ...
Referenced by

Create a mutable ref for a Point object, which will stay in sync as new operations are applied to the editor.

const pointRef: (editor: Editor, point: Point, options?: EditorPointRefOptions) => PointRef = ...
Referenced by

Get the set of currently tracked point refs of the editor.

const pointRefs: (editor: Editor) => Set<PointRef> = ...
Referenced by

Return all the positions in at range where a Point can be placed.

more
less

By default, moves forward by individual offsets at a time, but the unit option can be used to to move by character, word, line, or block.

The reverse option can be used to change iteration direction.

Note: By default void nodes are treated as a single point and iteration will not happen inside their content unless you pass in true for the voids option, then iteration will occur.

const positions: (editor: Editor, options?: EditorPositionsOptions) => Generator<Point, void, undefined> = ...
Referenced by

Get a range of a location.

const range: (editor: Editor, at: Location, to?: Location) => Range = ...
Referenced by

Create a mutable ref for a Range object, which will stay in sync as new operations are applied to the editor.

const rangeRef: (editor: Editor, range: Range, options?: EditorRangeRefOptions) => RangeRef = ...
Referenced by

Get the set of currently tracked range refs of the editor.

const rangeRefs: (editor: Editor) => Set<RangeRef> = ...
Referenced by

Get the start point of a location.

const start: (editor: Editor, at: Location) => Point = ...
Referenced by

Get the text string content of a location.

more
less

Note: by default the text of void nodes is considered to be an empty string, regardless of content, unless you pass in true for the voids option

const string: (editor: Editor, at: Location, options?: EditorStringOptions) => string = ...
Referenced by

Convert a range into a non-hanging one.

const unhangRange: (editor: Editor, range: Range, options?: EditorUnhangRangeOptions) => Range = ...
Referenced by

Match a void node in the current branch of the editor.

const void: (editor: Editor, options?: EditorVoidOptions) => NodeEntry<Element> | undefined = ...
Referenced by

Call a function, Determine whether or not remove the previous node when merge.

const shouldMergeNodesRemovePrevNode: (editor: Editor, prevNodeEntry: NodeEntry, curNodeEntry: NodeEntry) => boolean = ...
Referenced by
export type BaseSelection = Range | null
Referenced by
export type Selection = ExtendedType<"Selection", BaseSelection>
Referenced by
export type EditorMarks = Omit<Text, "text">
Referenced by
export interface EditorAboveOptions<T extends Ancestor> {
at?: Location;
match?: NodeMatch<T>;
mode?: MaximizeMode;
voids?: boolean;
}
Referenced by
export interface EditorAfterOptions {
distance?: number;
voids?: boolean;
}
Referenced by
export interface EditorBeforeOptions {
distance?: number;
voids?: boolean;
}
Referenced by
export interface EditorDirectedDeletionOptions {
unit?: TextUnit;
}
Referenced by
export interface EditorElementReadOnlyOptions {
at?: Location;
mode?: MaximizeMode;
voids?: boolean;
}
Referenced by
export interface EditorFragmentDeletionOptions {
direction?: TextDirection;
}
Referenced by
export interface EditorLeafOptions {
depth?: number;
edge?: LeafEdge;
}
Referenced by
export interface EditorLevelsOptions<T extends Node> {
at?: Location;
match?: NodeMatch<T>;
reverse?: boolean;
voids?: boolean;
}
Referenced by
export interface EditorNextOptions<T extends Descendant> {
at?: Location;
match?: NodeMatch<T>;
voids?: boolean;
}
Referenced by
export interface EditorNodeOptions {
depth?: number;
edge?: LeafEdge;
}
Referenced by
export interface EditorNodesOptions<T extends Node> {
at?: Location | Span;
match?: NodeMatch<T>;
universal?: boolean;
reverse?: boolean;
voids?: boolean;
pass?: (entry: NodeEntry) => boolean;
ignoreNonSelectable?: boolean;
}
Referenced by
export interface EditorNormalizeOptions {
force?: boolean;
operation?: Operation;
}
Referenced by
export interface EditorParentOptions {
depth?: number;
edge?: LeafEdge;
}
Referenced by
export interface EditorPathOptions {
depth?: number;
edge?: LeafEdge;
}
Referenced by
export interface EditorPathRefOptions {
affinity?: TextDirection | null;
}
Referenced by
export interface EditorPointOptions {
edge?: LeafEdge;
}
Referenced by
export interface EditorPointRefOptions {
affinity?: TextDirection | null;
}
Referenced by
export interface EditorPositionsOptions {
at?: Location;
reverse?: boolean;
voids?: boolean;
ignoreNonSelectable?: boolean;
}
Referenced by
export interface EditorPreviousOptions<T extends Node> {
at?: Location;
match?: NodeMatch<T>;
voids?: boolean;
}
Referenced by
export interface EditorRangeRefOptions {
affinity?: RangeDirection | null;
}
Referenced by
export interface EditorStringOptions {
voids?: boolean;
}
Referenced by
export interface EditorUnhangRangeOptions {
voids?: boolean;
}
Referenced by
export interface EditorVoidOptions {
at?: Location;
mode?: MaximizeMode;
voids?: boolean;
}
Referenced by
export interface EditorInterface {

Get the ancestor above a location in the document.

above: <T extends Ancestor>(editor: Editor, options?: EditorAboveOptions<T>) => NodeEntry<T> | undefined;

Add a custom property to the leaf text nodes in the current selection.

more
less

If the selection is currently collapsed, the marks will be added to the editor.marks property instead, and applied when text is inserted next.

addMark: (editor: Editor, key: string, value: any) => void;

Get the point after a location.

after: (editor: Editor, at: Location, options?: EditorAfterOptions) => Point | undefined;

Get the point before a location.

before: (editor: Editor, at: Location, options?: EditorBeforeOptions) => Point | undefined;

Delete content in the editor backward from the current selection.

deleteBackward: (editor: Editor, options?: EditorDirectedDeletionOptions) => void;

Delete content in the editor forward from the current selection.

deleteForward: (editor: Editor, options?: EditorDirectedDeletionOptions) => void;

Delete the content in the current selection.

deleteFragment: (editor: Editor, options?: EditorFragmentDeletionOptions) => void;

Get the start and end points of a location.

edges: (editor: Editor, at: Location) => [Point, Point];

Match a read-only element in the current branch of the editor.

elementReadOnly: (editor: Editor, options?: EditorElementReadOnlyOptions) => NodeEntry<Element> | undefined;

Get the end point of a location.

end: (editor: Editor, at: Location) => Point;

Get the first node at a location.

first: (editor: Editor, at: Location) => NodeEntry;

Get the fragment at a location.

fragment: (editor: Editor, at: Location) => Descendant[];

Check if a node has block children.

hasBlocks: (editor: Editor, element: Element) => boolean;

Check if a node has inline and text children.

hasInlines: (editor: Editor, element: Element) => boolean;
hasPath: (editor: Editor, path: Path) => boolean;

Check if a node has text children.

hasTexts: (editor: Editor, element: Element) => boolean;

Insert a block break at the current selection.

more
less

If the selection is currently expanded, it will be deleted first.

insertBreak: (editor: Editor) => void;

Inserts a fragment at the specified location or (if not defined) the current selection or (if not defined) the end of the document.

insertFragment: (editor: Editor, fragment: Node[], options?: TextInsertFragmentOptions) => void;

Atomically inserts nodes at the specified location or (if not defined) the current selection or (if not defined) the end of the document.

insertNode: <T extends Node>(editor: Editor, node: Node, options?: NodeInsertNodesOptions<T>) => void;

Insert a soft break at the current selection.

more
less

If the selection is currently expanded, it will be deleted first.

insertSoftBreak: (editor: Editor) => void;

Insert a string of text at the specified location or (if not defined) the current selection or (if not defined) the end of the document.

insertText: (editor: Editor, text: string, options?: TextInsertTextOptions) => void;

Check if a value is a block Element object.

isBlock: (editor: Editor, value: Element) => boolean;

Check if a point is an edge of a location.

isEdge: (editor: Editor, point: Point, at: Location) => boolean;

Check if a value is an Editor object.

isEditor: (value: any) => value is Editor;

Check if a value is a read-only Element object.

isElementReadOnly: (editor: Editor, element: Element) => boolean;

Check if an element is empty, accounting for void nodes.

isEmpty: (editor: Editor, element: Element) => boolean;

Check if a point is the end point of a location.

isEnd: (editor: Editor, point: Point, at: Location) => boolean;

Check if a value is an inline Element object.

isInline: (editor: Editor, value: Element) => boolean;

Check if the editor is currently normalizing after each operation.

isNormalizing: (editor: Editor) => boolean;

Check if a value is a selectable Element object.

isSelectable: (editor: Editor, element: Element) => boolean;

Check if a point is the start point of a location.

isStart: (editor: Editor, point: Point, at: Location) => boolean;

Check if a value is a void Element object.

isVoid: (editor: Editor, value: Element) => boolean;

Get the last node at a location.

last: (editor: Editor, at: Location) => NodeEntry;

Get the leaf text node at a location.

leaf: (editor: Editor, at: Location, options?: EditorLeafOptions) => NodeEntry<Text>;

Iterate through all of the levels at a location.

levels: <T extends Node>(editor: Editor, options?: EditorLevelsOptions<T>) => Generator<NodeEntry<T>, void, undefined>;

Get the marks that would be added to text at the current selection.

marks: (editor: Editor) => Omit<Text, "text"> | null;

Get the matching node in the branch of the document after a location.

next: <T extends Descendant>(editor: Editor, options?: EditorNextOptions<T>) => NodeEntry<T> | undefined;

Get the node at a location.

node: (editor: Editor, at: Location, options?: EditorNodeOptions) => NodeEntry;

Iterate through all of the nodes in the Editor.

nodes: <T extends Node>(editor: Editor, options?: EditorNodesOptions<T>) => Generator<NodeEntry<T>, void, undefined>;

Normalize any dirty objects in the editor.

normalize: (editor: Editor, options?: EditorNormalizeOptions) => void;

Get the parent node of a location.

parent: (editor: Editor, at: Location, options?: EditorParentOptions) => NodeEntry<Ancestor>;

Get the path of a location.

path: (editor: Editor, at: Location, options?: EditorPathOptions) => Path;

Create a mutable ref for a Path object, which will stay in sync as new operations are applied to the editor.

pathRef: (editor: Editor, path: Path, options?: EditorPathRefOptions) => PathRef;

Get the set of currently tracked path refs of the editor.

pathRefs: (editor: Editor) => Set<PathRef>;

Get the start or end point of a location.

point: (editor: Editor, at: Location, options?: EditorPointOptions) => Point;

Create a mutable ref for a Point object, which will stay in sync as new operations are applied to the editor.

pointRef: (editor: Editor, point: Point, options?: EditorPointRefOptions) => PointRef;

Get the set of currently tracked point refs of the editor.

pointRefs: (editor: Editor) => Set<PointRef>;

Return all the positions in at range where a Point can be placed.

more
less

By default, moves forward by individual offsets at a time, but the unit option can be used to to move by character, word, line, or block.

The reverse option can be used to change iteration direction.

Note: By default void nodes are treated as a single point and iteration will not happen inside their content unless you pass in true for the voids option, then iteration will occur.

positions: (editor: Editor, options?: EditorPositionsOptions) => Generator<Point, void, undefined>;

Get the matching node in the branch of the document before a location.

previous: <T extends Node>(editor: Editor, options?: EditorPreviousOptions<T>) => NodeEntry<T> | undefined;

Get a range of a location.

range: (editor: Editor, at: Location, to?: Location) => Range;

Create a mutable ref for a Range object, which will stay in sync as new operations are applied to the editor.

rangeRef: (editor: Editor, range: Range, options?: EditorRangeRefOptions) => RangeRef;

Get the set of currently tracked range refs of the editor.

rangeRefs: (editor: Editor) => Set<RangeRef>;

Remove a custom property from all of the leaf text nodes in the current selection.

more
less

If the selection is currently collapsed, the removal will be stored on editor.marks and applied to the text inserted next.

removeMark: (editor: Editor, key: string) => void;

Manually set if the editor should currently be normalizing.

more
less

Note: Using this incorrectly can leave the editor in an invalid state.

setNormalizing: (editor: Editor, isNormalizing: boolean) => void;

Get the start point of a location.

start: (editor: Editor, at: Location) => Point;

Get the text string content of a location.

more
less

Note: by default the text of void nodes is considered to be an empty string, regardless of content, unless you pass in true for the voids option

string: (editor: Editor, at: Location, options?: EditorStringOptions) => string;

Convert a range into a non-hanging one.

unhangRange: (editor: Editor, range: Range, options?: EditorUnhangRangeOptions) => Range;

Match a void node in the current branch of the editor.

void: (editor: Editor, options?: EditorVoidOptions) => NodeEntry<Element> | undefined;

Call a function, deferring normalization until after it completes.

withoutNormalizing: (editor: Editor, fn: () => void) => void;

Call a function, Determine whether or not remove the previous node when merge.

shouldMergeNodesRemovePrevNode: (editor: Editor, prevNodeEntry: NodeEntry, curNodeEntry: NodeEntry) => boolean;
}
Referenced by
Unexported symbols referenced here
interface TextInsertFragmentOptions {
at?: Location;
hanging?: boolean;
voids?: boolean;
batchDirty?: boolean;
}
Referenced by
interface NodeInsertNodesOptions<T extends Node> {
at?: Location;
match?: NodeMatch<T>;
mode?: RangeMode;
hanging?: boolean;
select?: boolean;
voids?: boolean;
batchDirty?: boolean;
}
Referenced by
interface TextInsertTextOptions {
at?: Location;
voids?: boolean;
}
Referenced by

A helper type for narrowing matched nodes with a predicate.

export type NodeMatch<T extends Node> = ((node: Node, path: Path) => node is T) | ((node: Node, path: Path) => boolean)
Referenced by
export type PropsCompare = (prop: Partial<Node>, node: Partial<Node>) => boolean
Referenced by
export type PropsMerge = (prop: Partial<Node>, node: Partial<Node>) => object
Referenced by

Element objects are a type of node in a Slate document that contain other element nodes or text nodes. They can be either "blocks" or "inlines" depending on the Slate editor's configuration.

export interface BaseElement {
children: Descendant[];
}
Referenced by
export type Element = ExtendedType<"Element", BaseElement>
export const Element: ElementInterface = ...
Referenced by
export interface ElementInterface {

Check if a value implements the 'Ancestor' interface.

isAncestor: (value: any) => value is Ancestor;

Check if a value implements the Element interface.

isElement: (value: any) => value is Element;

Check if a value is an array of Element objects.

isElementList: (value: any) => value is Element[];

Check if a set of props is a partial of Element.

isElementProps: (props: any) => props is Partial<Element>;

Check if a value implements the Element interface and has elementKey with selected value. Default it check to type key value

isElementType: <T extends Element>(value: any, elementVal: string, elementKey?: string) => value is T;

Check if an element matches set of properties.

more
less

Note: this checks custom properties, and it does not ensure that any children are equivalent.

matches: (element: Element, props: Partial<Element>) => boolean;
}
Referenced by

ElementEntry objects refer to an Element and the Path where it can be found inside a root node.

export type ElementEntry = [Element, Path]
Referenced by

The Location interface is a union of the ways to refer to a specific location in a Slate document: paths, points or ranges.

more
less

Methods will often accept a Location instead of requiring only a Path, Point or Range. This eliminates the need for developers to manage converting between the different interfaces in their own code base.

export type Location = Path | Point | Range
export const Location: LocationInterface = ...
Referenced by
export interface LocationInterface {

Check if a value implements the Location interface.

isLocation: (value: any) => value is Location;
}
Referenced by

The Span interface is a low-level way to refer to locations in nodes without using Point which requires leaf text nodes to be present.

export type Span = [Path, Path]
export const Span: SpanInterface = ...
Referenced by
export interface SpanInterface {

Check if a value implements the Span interface.

isSpan: (value: any) => value is Span;
}
Referenced by

The Node union type represents all of the different types of nodes that occur in a Slate document tree.

export type BaseNode = Editor | Element | Text
export interface NodeAncestorsOptions {
reverse?: boolean;
}
Referenced by
export interface NodeChildrenOptions {
reverse?: boolean;
}
Referenced by
export interface NodeDescendantsOptions {
from?: Path;
to?: Path;
reverse?: boolean;
pass?: (node: NodeEntry) => boolean;
}
Referenced by
export interface NodeElementsOptions {
from?: Path;
to?: Path;
reverse?: boolean;
pass?: (node: NodeEntry) => boolean;
}
Referenced by
export interface NodeLevelsOptions {
reverse?: boolean;
}
Referenced by
export interface NodeNodesOptions {
from?: Path;
to?: Path;
reverse?: boolean;
pass?: (entry: NodeEntry) => boolean;
}
Referenced by
export interface NodeTextsOptions {
from?: Path;
to?: Path;
reverse?: boolean;
pass?: (node: NodeEntry) => boolean;
}
Referenced by
export interface NodeInterface {

Get the node at a specific path, asserting that it's an ancestor node.

ancestor: (root: Node, path: Path) => Ancestor;

Return a generator of all the ancestor nodes above a specific path.

more
less

By default the order is top-down, from highest to lowest ancestor in the tree, but you can pass the reverse: true option to go bottom-up.

ancestors: (root: Node, path: Path, options?: NodeAncestorsOptions) => Generator<NodeEntry<Ancestor>, void, undefined>;

Get the child of a node at a specific index.

child: (root: Node, index: number) => Descendant;

Iterate over the children of a node at a specific path.

children: (root: Node, path: Path, options?: NodeChildrenOptions) => Generator<NodeEntry<Descendant>, void, undefined>;

Get an entry for the common ancesetor node of two paths.

common: (root: Node, path: Path, another: Path) => NodeEntry;

Get the node at a specific path, asserting that it's a descendant node.

descendant: (root: Node, path: Path) => Descendant;

Return a generator of all the descendant node entries inside a root node.

descendants: (root: Node, options?: NodeDescendantsOptions) => Generator<NodeEntry<Descendant>, void, undefined>;

Return a generator of all the element nodes inside a root node. Each iteration will return an ElementEntry tuple consisting of [Element, Path]. If the root node is an element it will be included in the iteration as well.

elements: (root: Node, options?: NodeElementsOptions) => Generator<ElementEntry, void, undefined>;

Extract props from a Node.

extractProps: (node: Node) => NodeProps;

Get the first node entry in a root node from a path.

first: (root: Node, path: Path) => NodeEntry;

Get the sliced fragment represented by a range inside a root node.

fragment: (root: Node, range: Range) => Descendant[];

Get the descendant node referred to by a specific path. If the path is an empty array, it refers to the root node itself.

get: (root: Node, path: Path) => Node;

Similar to get, but returns undefined if the node does not exist.

getIf: (root: Node, path: Path) => Node | undefined;

Check if a descendant node exists at a specific path.

has: (root: Node, path: Path) => boolean;

Check if a value implements the Node interface.

isNode: (value: any) => value is Node;

Check if a value is a list of Node objects.

isNodeList: (value: any) => value is Node[];

Get the last node entry in a root node from a path.

last: (root: Node, path: Path) => NodeEntry;

Get the node at a specific path, ensuring it's a leaf text node.

leaf: (root: Node, path: Path) => Text;

Return a generator of the in a branch of the tree, from a specific path.

more
less

By default the order is top-down, from highest to lowest node in the tree, but you can pass the reverse: true option to go bottom-up.

levels: (root: Node, path: Path, options?: NodeLevelsOptions) => Generator<NodeEntry, void, undefined>;

Check if a node matches a set of props.

matches: (node: Node, props: Partial<Node>) => boolean;

Return a generator of all the node entries of a root node. Each entry is returned as a [Node, Path] tuple, with the path referring to the node's position inside the root node.

nodes: (root: Node, options?: NodeNodesOptions) => Generator<NodeEntry, void, undefined>;

Get the parent of a node at a specific path.

parent: (root: Node, path: Path) => Ancestor;

Get the concatenated text string of a node's content.

more
less

Note that this will not include spaces or line breaks between block nodes. It is not a user-facing string, but a string for performing offset-related computations for a node.

string: (node: Node) => string;

Return a generator of all leaf text nodes in a root node.

texts: (root: Node, options?: NodeTextsOptions) => Generator<NodeEntry<Text>, void, undefined>;
}
Referenced by

The Descendant union type represents nodes that are descendants in the tree. It is returned as a convenience in certain cases to narrow a value further than the more generic Node union.

export type Descendant = Element | Text
Referenced by

The Ancestor union type represents nodes that are ancestors in the tree. It is returned as a convenience in certain cases to narrow a value further than the more generic Node union.

export type Ancestor = Editor | Element
Referenced by

NodeEntry objects are returned when iterating over the nodes in a Slate document tree. They consist of the node and its Path relative to the root node in the document.

export type NodeEntry<T extends Node = Node> = [T, Path]
Referenced by

Convenience type for returning the props of a node.

export type NodeProps = Omit<Editor, "children"> | Omit<Element, "children"> | Omit<Text, "text">
Referenced by
export type BaseInsertNodeOperation = {
type: "insert_node";
path: Path;
node: Node;
}
Referenced by
export type InsertNodeOperation = ExtendedType<"InsertNodeOperation", BaseInsertNodeOperation>
Referenced by
export type BaseInsertTextOperation = {
type: "insert_text";
path: Path;
offset: number;
text: string;
}
Referenced by
export type InsertTextOperation = ExtendedType<"InsertTextOperation", BaseInsertTextOperation>
Referenced by
export type BaseMergeNodeOperation = {
type: "merge_node";
path: Path;
position: number;
properties: Partial<Node>;
}
Referenced by
export type MergeNodeOperation = ExtendedType<"MergeNodeOperation", BaseMergeNodeOperation>
Referenced by
export type BaseMoveNodeOperation = {
type: "move_node";
path: Path;
newPath: Path;
}
Referenced by
export type MoveNodeOperation = ExtendedType<"MoveNodeOperation", BaseMoveNodeOperation>
Referenced by
export type BaseRemoveNodeOperation = {
type: "remove_node";
path: Path;
node: Node;
}
Referenced by
export type RemoveNodeOperation = ExtendedType<"RemoveNodeOperation", BaseRemoveNodeOperation>
Referenced by
export type BaseRemoveTextOperation = {
type: "remove_text";
path: Path;
offset: number;
text: string;
}
Referenced by
export type RemoveTextOperation = ExtendedType<"RemoveTextOperation", BaseRemoveTextOperation>
Referenced by
export type BaseSetNodeOperation = {
type: "set_node";
path: Path;
properties: Partial<Node>;
newProperties: Partial<Node>;
}
Referenced by
export type SetNodeOperation = ExtendedType<"SetNodeOperation", BaseSetNodeOperation>
Referenced by
export type BaseSetSelectionOperation = {
type: "set_selection";
properties: null;
newProperties: Range;
} | {
type: "set_selection";
properties: Partial<Range>;
newProperties: Partial<Range>;
} | {
type: "set_selection";
properties: Range;
newProperties: null;
}
Referenced by
export type SetSelectionOperation = ExtendedType<"SetSelectionOperation", BaseSetSelectionOperation>
Referenced by
export type BaseSplitNodeOperation = {
type: "split_node";
path: Path;
position: number;
properties: Partial<Node>;
}
Referenced by
export type SplitNodeOperation = ExtendedType<"SplitNodeOperation", BaseSplitNodeOperation>
Referenced by

Operation objects define the low-level instructions that Slate editors use to apply changes to their internal state. Representing all changes as operations is what allows Slate editors to easily implement history, collaboration, and other features.

export type BaseOperation = NodeOperation | SelectionOperation | TextOperation
Referenced by
export type Operation = ExtendedType<"Operation", BaseOperation>
export const Operation: OperationInterface = ...
Referenced by
export interface OperationInterface {

Check if a value is a NodeOperation object.

isNodeOperation: (value: any) => value is NodeOperation;

Check if a value is an Operation object.

isOperation: (value: any) => value is Operation;

Check if a value is a list of Operation objects.

isOperationList: (value: any) => value is Operation[];

Check if a value is a SelectionOperation object.

isSelectionOperation: (value: any) => value is SelectionOperation;

Check if a value is a TextOperation object.

isTextOperation: (value: any) => value is TextOperation;

Invert an operation, returning a new operation that will exactly undo the original when applied.

inverse: (op: Operation) => Operation;
}
Referenced by

PathRef objects keep a specific path in a document synced over time as new operations are applied to the editor. You can access their current property at any time for the up-to-date path value.

export interface PathRef {
current: Path | null;
affinity: "forward" | "backward" | null;
unref(): Path | null;
}
export const PathRef: PathRefInterface = ...
Referenced by
export interface PathRefInterface {

Transform the path ref's current value by an operation.

transform: (ref: PathRef, op: Operation) => void;
}
Referenced by

Path arrays are a list of indexes that describe a node's exact position in a Slate node tree. Although they are usually relative to the root Editor object, they can be relative to any Node object.

export type Path = number[]
export const Path: PathInterface = ...
Referenced by
export interface PathAncestorsOptions {
reverse?: boolean;
}
Referenced by
export interface PathLevelsOptions {
reverse?: boolean;
}
Referenced by
export interface PathTransformOptions {
affinity?: TextDirection | null;
}
Referenced by
export interface PathInterface {

Get a list of ancestor paths for a given path.

more
less

The paths are sorted from shallowest to deepest ancestor. However, if the reverse: true option is passed, they are reversed.

ancestors: (path: Path, options?: PathAncestorsOptions) => Path[];

Get the common ancestor path of two paths.

common: (path: Path, another: Path) => Path;

Compare a path to another, returning an integer indicating whether the path was before, at, or after the other.

more
less

Note: Two paths of unequal length can still receive a 0 result if one is directly above or below the other. If you want exact matching, use [[Path.equals]] instead.

compare: (path: Path, another: Path) => -1 | 0 | 1;

Check if a path ends after one of the indexes in another.

endsAfter: (path: Path, another: Path) => boolean;

Check if a path ends at one of the indexes in another.

endsAt: (path: Path, another: Path) => boolean;

Check if a path ends before one of the indexes in another.

endsBefore: (path: Path, another: Path) => boolean;

Check if a path is exactly equal to another.

equals: (path: Path, another: Path) => boolean;

Check if the path of previous sibling node exists

hasPrevious: (path: Path) => boolean;

Check if a path is after another.

isAfter: (path: Path, another: Path) => boolean;

Check if a path is an ancestor of another.

isAncestor: (path: Path, another: Path) => boolean;

Check if a path is before another.

isBefore: (path: Path, another: Path) => boolean;

Check if a path is a child of another.

isChild: (path: Path, another: Path) => boolean;

Check if a path is equal to or an ancestor of another.

isCommon: (path: Path, another: Path) => boolean;

Check if a path is a descendant of another.

isDescendant: (path: Path, another: Path) => boolean;

Check if a path is the parent of another.

isParent: (path: Path, another: Path) => boolean;

Check is a value implements the Path interface.

isPath: (value: any) => value is Path;

Check if a path is a sibling of another.

isSibling: (path: Path, another: Path) => boolean;

Get a list of paths at every level down to a path. Note: this is the same as Path.ancestors, but including the path itself.

more
less

The paths are sorted from shallowest to deepest. However, if the reverse: true option is passed, they are reversed.

levels: (path: Path, options?: PathLevelsOptions) => Path[];

Given a path, get the path to the next sibling node.

next: (path: Path) => Path;

Returns whether this operation can affect paths or not. Used as an optimization when updating dirty paths during normalization

more
less

NOTE: This must be kept in sync with the implementation of 'transform' below

operationCanTransformPath: (operation: Operation) => operation is InsertNodeOperation | RemoveNodeOperation | MergeNodeOperation | SplitNodeOperation | MoveNodeOperation;

Given a path, return a new path referring to the parent node above it.

parent: (path: Path) => Path;

Given a path, get the path to the previous sibling node.

previous: (path: Path) => Path;

Get a path relative to an ancestor.

relative: (path: Path, ancestor: Path) => Path;

Transform a path by an operation.

transform: (path: Path, operation: Operation, options?: PathTransformOptions) => Path | null;
}
Referenced by

PointRef objects keep a specific point in a document synced over time as new operations are applied to the editor. You can access their current property at any time for the up-to-date point value.

export interface PointRef {
current: Point | null;
affinity: TextDirection | null;
unref(): Point | null;
}
export const PointRef: PointRefInterface = ...
Referenced by
export interface PointRefInterface {

Transform the point ref's current value by an operation.

transform: (ref: PointRef, op: Operation) => void;
}
Referenced by

Point objects refer to a specific location in a text node in a Slate document. Its path refers to the location of the node in the tree, and its offset refers to the distance into the node's string of text. Points can only refer to Text nodes.

export interface BasePoint {
path: Path;
offset: number;
}
Referenced by
export type Point = ExtendedType<"Point", BasePoint>
export const Point: PointInterface = ...
Referenced by
export interface PointTransformOptions {
affinity?: TextDirection | null;
}
Referenced by
export interface PointInterface {

Compare a point to another, returning an integer indicating whether the point was before, at, or after the other.

compare: (point: Point, another: Point) => -1 | 0 | 1;

Check if a point is after another.

isAfter: (point: Point, another: Point) => boolean;

Check if a point is before another.

isBefore: (point: Point, another: Point) => boolean;

Check if a point is exactly equal to another.

equals: (point: Point, another: Point) => boolean;

Check if a value implements the Point interface.

isPoint: (value: any) => value is Point;

Transform a point by an operation.

transform: (point: Point, op: Operation, options?: PointTransformOptions) => Point | null;
}
Referenced by

PointEntry objects are returned when iterating over Point objects that belong to a range.

export type PointEntry = [Point, "anchor" | "focus"]

RangeRef objects keep a specific range in a document synced over time as new operations are applied to the editor. You can access their current property at any time for the up-to-date range value.

export interface RangeRef {
current: Range | null;
affinity: "forward" | "backward" | "outward" | "inward" | null;
unref(): Range | null;
}
export const RangeRef: RangeRefInterface = ...
Referenced by
export interface RangeRefInterface {

Transform the range ref's current value by an operation.

transform: (ref: RangeRef, op: Operation) => void;
}
Referenced by

Range objects are a set of points that refer to a specific span of a Slate document. They can define a span inside a single node or a can span across multiple nodes.

export interface BaseRange {
anchor: Point;
focus: Point;
}
Referenced by
export type Range = ExtendedType<"Range", BaseRange>
export const Range: RangeInterface = ...
Referenced by
export interface RangeEdgesOptions {
reverse?: boolean;
}
Referenced by
export interface RangeTransformOptions {
affinity?: RangeDirection | null;
}
Referenced by
export interface RangeInterface {

Get the start and end points of a range, in the order in which they appear in the document.

edges: (range: Range, options?: RangeEdgesOptions) => [Point, Point];

Get the end point of a range.

end: (range: Range) => Point;

Check if a range is exactly equal to another.

equals: (range: Range, another: Range) => boolean;

Check if a range includes a path, a point or part of another range.

includes: (range: Range, target: Path | Point | Range) => boolean;

Check if a range includes another range.

surrounds: (range: Range, target: Range) => boolean;

Get the intersection of a range with another.

intersection: (range: Range, another: Range) => Range | null;

Check if a range is backward, meaning that its anchor point appears in the document after its focus point.

isBackward: (range: Range) => boolean;

Check if a range is collapsed, meaning that both its anchor and focus points refer to the exact same position in the document.

isCollapsed: (range: Range) => boolean;

Check if a range is expanded.

more
less

This is the opposite of [[Range.isCollapsed]] and is provided for legibility.

isExpanded: (range: Range) => boolean;

Check if a range is forward.

more
less

This is the opposite of [[Range.isBackward]] and is provided for legibility.

isForward: (range: Range) => boolean;

Check if a value implements the [[Range]] interface.

isRange: (value: any) => value is Range;

Iterate through all of the point entries in a range.

points: (range: Range) => Generator<PointEntry, void, undefined>;

Get the start point of a range.

start: (range: Range) => Point;

Transform a range by an operation.

transform: (range: Range, op: Operation, options?: RangeTransformOptions) => Range | null;
}
Referenced by
export type Scrubber = (key: string, value: unknown) => unknown

This interface implements a stringify() function, which is used by Slate internally when generating exceptions containing end user data. Developers using Slate may call Scrubber.setScrubber() to alter the behavior of this stringify() function.

more
less

For example, to prevent the cleartext logging of 'text' fields within Nodes:

import { Scrubber } from 'slate'; Scrubber.setScrubber((key, val) => { if (key === 'text') return '...scrubbed...' return val });

export const Scrubber: ScrubberInterface = ...
Referenced by
export interface ScrubberInterface {
setScrubber(scrubber: Scrubber | undefined): void;
stringify(value: any): string;
}
Referenced by

Text objects represent the nodes that contain the actual text content of a Slate document along with any formatting properties. They are always leaf nodes in the document tree as they cannot contain any children.

export interface BaseText {
text: string;
}
Referenced by
export type Text = ExtendedType<"Text", BaseText>
export const Text: TextInterface = ...
Referenced by
export interface TextEqualsOptions {
loose?: boolean;
}
Referenced by
export type DecoratedRange = Range & {

Customize how another decoration is merged into a text node. If not specified, Object.assign would be used. It is useful for overlapping decorations with the same key but different values.

merge?: (leaf: Text, decoration: object) => void;
}
Referenced by
export interface TextInterface {

Check if two text nodes are equal.

more
less

When loose is set, the text is not compared. This is used to check whether sibling text nodes can be merged.

equals: (text: Text, another: Text, options?: TextEqualsOptions) => boolean;

Check if a value implements the Text interface.

isText: (value: any) => value is Text;

Check if a value is a list of Text objects.

isTextList: (value: any) => value is Text[];

Check if some props are a partial of Text.

isTextProps: (props: any) => props is Partial<Text>;

Check if an text matches set of properties.

more
less

Note: this is for matching custom properties, and it does not ensure that the text property are two nodes equal.

matches: (text: Text, props: Partial<Text>) => boolean;

Get the leaves for a text node given decorations.

decorations: (node: Text, decorations: DecoratedRange[]) => Text[];
}
Referenced by
Unexported symbols referenced here
interface GeneralTransforms {

Transform the editor by an operation.

transform: (editor: Editor, op: Operation) => void;
}
const GeneralTransforms: GeneralTransforms = ...
Referenced by
interface NodeTransforms {

Insert nodes in the editor at the specified location or (if not defined) the current selection or (if not defined) the end of the document.

insertNodes: <T extends Node>(editor: Editor, nodes: Node | Node[], options?: NodeInsertNodesOptions<T>) => void;

Lift nodes at a specific location upwards in the document tree, splitting their parent in two if necessary.

liftNodes: <T extends Node>(editor: Editor, options?: {
at?: Location;
match?: NodeMatch<T>;
mode?: MaximizeMode;
voids?: boolean;
}) => void;

Merge a node at a location with the previous node of the same depth, removing any empty containing nodes after the merge if necessary.

mergeNodes: <T extends Node>(editor: Editor, options?: {
at?: Location;
match?: NodeMatch<T>;
mode?: RangeMode;
hanging?: boolean;
voids?: boolean;
}) => void;

Move the nodes at a location to a new location.

moveNodes: <T extends Node>(editor: Editor, options: {
at?: Location;
match?: NodeMatch<T>;
mode?: MaximizeMode;
to: Path;
voids?: boolean;
}) => void;

Remove the nodes at a specific location in the document.

removeNodes: <T extends Node>(editor: Editor, options?: {
at?: Location;
match?: NodeMatch<T>;
mode?: RangeMode;
hanging?: boolean;
voids?: boolean;
}) => void;

Set new properties on the nodes at a location.

setNodes: <T extends Node>(editor: Editor, props: Partial<T>, options?: {
at?: Location;
match?: NodeMatch<T>;
mode?: MaximizeMode;
hanging?: boolean;
split?: boolean;
voids?: boolean;
compare?: PropsCompare;
merge?: PropsMerge;
}) => void;

Split the nodes at a specific location.

splitNodes: <T extends Node>(editor: Editor, options?: {
at?: Location;
match?: NodeMatch<T>;
mode?: RangeMode;
always?: boolean;
height?: number;
voids?: boolean;
}) => void;

Unset properties on the nodes at a location.

unsetNodes: <T extends Node>(editor: Editor, props: string | string[], options?: {
at?: Location;
match?: NodeMatch<T>;
mode?: MaximizeMode;
hanging?: boolean;
split?: boolean;
voids?: boolean;
}) => void;

Unwrap the nodes at a location from a parent node, splitting the parent if necessary to ensure that only the content in the range is unwrapped.

unwrapNodes: <T extends Node>(editor: Editor, options?: {
at?: Location;
match?: NodeMatch<T>;
mode?: MaximizeMode;
split?: boolean;
voids?: boolean;
}) => void;

Wrap the nodes at a location in a new container node, splitting the edges of the range first to ensure that only the content in the range is wrapped.

wrapNodes: <T extends Node>(editor: Editor, element: Element, options?: {
at?: Location;
match?: NodeMatch<T>;
mode?: MaximizeMode;
split?: boolean;
voids?: boolean;
}) => void;
}
const NodeTransforms: NodeTransforms = ...
Referenced by
interface SelectionTransforms {

Collapse the selection.

collapse: (editor: Editor, options?: SelectionCollapseOptions) => void;

Unset the selection.

deselect: (editor: Editor) => void;

Move the selection's point forward or backward.

move: (editor: Editor, options?: SelectionMoveOptions) => void;

Set the selection to a new value.

select: (editor: Editor, target: Location) => void;

Set new properties on one of the selection's points.

setPoint: (editor: Editor, props: Partial<Point>, options?: SelectionSetPointOptions) => void;

Set new properties on the selection.

setSelection: (editor: Editor, props: Partial<Range>) => void;
}
const SelectionTransforms: SelectionTransforms = ...
Referenced by
interface TextTransforms {

Delete content in the editor.

delete: (editor: Editor, options?: TextDeleteOptions) => void;

Insert a fragment in the editor at the specified location or (if not defined) the current selection or (if not defined) the end of the document.

insertFragment: (editor: Editor, fragment: Node[], options?: TextInsertFragmentOptions) => void;

Insert a string of text in the editor at the specified location or (if not defined) the current selection or (if not defined) the end of the document.

insertText: (editor: Editor, text: string, options?: TextInsertTextOptions) => void;
}
const TextTransforms: TextTransforms = ...
Referenced by
interface SelectionCollapseOptions { }
Referenced by
interface SelectionMoveOptions {
distance?: number;
unit?: MoveUnit;
reverse?: boolean;
}
Referenced by
interface SelectionSetPointOptions { }
Referenced by
interface TextDeleteOptions {
at?: Location;
distance?: number;
unit?: TextUnit;
reverse?: boolean;
hanging?: boolean;
voids?: boolean;
}
Referenced by
export const insertNodes: NodeTransforms["insertNodes"] = ...
export const liftNodes: NodeTransforms["liftNodes"] = ...
export const mergeNodes: NodeTransforms["mergeNodes"] = ...
export const moveNodes: NodeTransforms["moveNodes"] = ...
export const removeNodes: NodeTransforms["removeNodes"] = ...
export const setNodes: NodeTransforms["setNodes"] = ...
export const splitNodes: NodeTransforms["splitNodes"] = ...
export const unsetNodes: NodeTransforms["unsetNodes"] = ...
export const unwrapNodes: NodeTransforms["unwrapNodes"] = ...
export const wrapNodes: NodeTransforms["wrapNodes"] = ...
export const collapse: SelectionTransforms["collapse"] = ...
export const deselect: SelectionTransforms["deselect"] = ...
export const move: SelectionTransforms["move"] = ...
export const select: SelectionTransforms["select"] = ...
export const setPoint: SelectionTransforms["setPoint"] = ...
export const setSelection: SelectionTransforms["setSelection"] = ...
export const deleteText: TextTransforms["delete"] = ...
export const insertFragment: TextTransforms["insertFragment"] = ...
export interface CustomTypes {
[key: string]: unknown;
}
Referenced by
export type ExtendedType<K extends ExtendableTypes, B> = unknown extends CustomTypes[K] ? B : CustomTypes[K]
Referenced by
Unexported symbols referenced here

Extendable Custom Types Interface

type ExtendableTypes = "Editor" | "Element" | "Text" | "Selection" | "Range" | "Point" | "Operation" | "InsertNodeOperation" | "InsertTextOperation" | "MergeNodeOperation" | "MoveNodeOperation" | "RemoveNodeOperation" | "RemoveTextOperation" | "SetNodeOperation" | "SetSelectionOperation" | "SplitNodeOperation"
Referenced by
export type MoveUnit = "offset" | "character" | "word" | "line"
Referenced by
export type RangeDirection = TextDirection | "outward" | "inward"
Referenced by
export type RangeMode = "highest" | "lowest"
Referenced by
export type SelectionEdge = "anchor" | "focus" | "start" | "end"
Referenced by
export type SelectionMode = "all" | "highest" | "lowest"
Referenced by
export type TextUnit = "character" | "word" | "line" | "block"
Referenced by
}