docs/api/slate/operation.mdx
An Operation is the lowest-level instructions that Plate editors use to apply changes to their internal state. Representing all changes as operations is what allows Plate editors to easily implement history, collaboration, and other features.
export type Operation<N extends Descendant = Descendant> =
| NodeOperation<N>
| SelectionOperation
| TextOperation;
OperationApiisNodeOperationCheck if a value is a NodeOperation object.
inverseInvert an operation, returning a new operation that will exactly undo the original when applied.
<API name="inverse"> <APIParameters> <APIItem name="op" type="Operation"> The operation to invert. </APIItem> </APIParameters> <APIReturns type="Operation"> A new operation that undoes the original operation. </APIReturns> </API>isOperationCheck if a value is an Operation object.
isOperationListCheck if a value is a list of Operation objects.
isSelectionOperationCheck if a value is a SelectionOperation object.
isTextOperationCheck if a value is a TextOperation object.
Operationexport type Operation<N extends Descendant = Descendant> =
| NodeOperation<N>
| SelectionOperation
| TextOperation;
NodeOperationA node operation modifies a node.
export type NodeOperation<N extends Descendant = Descendant> =
| InsertNodeOperation<N>
| MergeNodeOperation<N>
| MoveNodeOperation
| RemoveNodeOperation<N>
| SetNodeOperation<N>
| SplitNodeOperation<N>;
SelectionOperationA selection operation modifies the selection.
export type SelectionOperation = SetSelectionOperation;
TextOperationA text operation modifies text content.
export type TextOperation = InsertTextOperation | RemoveTextOperation;
InsertNodeOperationMergeNodeOperationMoveNodeOperationRemoveNodeOperationSetNodeOperationSplitNodeOperationSetSelectionOperationInsertTextOperationRemoveTextOperation