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;
OperationApi
isNodeOperation
Check if a value is a NodeOperation
object.
inverse
Invert an operation, returning a new operation that will exactly undo the original when applied.
isOperation
Check if a value is an Operation
object.
isOperationList
Check if a value is a list of Operation
objects.
isSelectionOperation
Check if a value is a SelectionOperation
object.
isTextOperation
Check if a value is a TextOperation
object.
Types
Operation
export type Operation<N extends Descendant = Descendant> =
| NodeOperation<N>
| SelectionOperation
| TextOperation;
NodeOperation
A node operation modifies a node.
export type NodeOperation<N extends Descendant = Descendant> =
| InsertNodeOperation<N>
| MergeNodeOperation<N>
| MoveNodeOperation
| RemoveNodeOperation<N>
| SetNodeOperation<N>
| SplitNodeOperation<N>;
SelectionOperation
A selection operation modifies the selection.
export type SelectionOperation = SetSelectionOperation;
TextOperation
A text operation modifies text content.
export type TextOperation = InsertTextOperation | RemoveTextOperation;
InsertNodeOperation
MergeNodeOperation
MoveNodeOperation
RemoveNodeOperation
SetNodeOperation
SplitNodeOperation
SetSelectionOperation
InsertTextOperation
RemoveTextOperation
On This Page
OperationApiisNodeOperationinverseisOperationisOperationListisSelectionOperationisTextOperationTypesOperationNodeOperationSelectionOperationTextOperationInsertNodeOperationMergeNodeOperationMoveNodeOperationRemoveNodeOperationSetNodeOperationSplitNodeOperationSetSelectionOperationInsertTextOperationRemoveTextOperation