mirror of
https://github.com/codex-team/editor.js
synced 2024-06-08 08:52:15 +02:00
35 lines
869 B
TypeScript
35 lines
869 B
TypeScript
import { OutputBlockData } from '../index';
|
|
import { BlockMutationType } from '../events/block/mutation-type';
|
|
|
|
/**
|
|
* Action for creating a new block in the editor
|
|
* This action will add the new block to the state
|
|
*/
|
|
export interface CreateBlockAction {
|
|
type: BlockMutationType.Added;
|
|
data: OutputBlockData;
|
|
}
|
|
|
|
/**
|
|
* Action for changing data of an existing block
|
|
* This action will change block data in the state by its id
|
|
*/
|
|
export interface ChangeBlockDataAction {
|
|
type: BlockMutationType.Changed;
|
|
data: OutputBlockData;
|
|
}
|
|
|
|
/**
|
|
* Action for removing a block from the editor
|
|
* This action will remove the block from the state by its id
|
|
*/
|
|
export interface RemoveBlockAction {
|
|
type: BlockMutationType.Removed;
|
|
blockId: string;
|
|
}
|
|
|
|
/**
|
|
* Available action types
|
|
*/
|
|
export type Action = CreateBlockAction | ChangeBlockDataAction | RemoveBlockAction;
|