Type Alias Delta<T>

Delta:
    | {
        attributes?: { [key in string]: {} };
        delete?: undefined;
        insert: T;
        retain?: undefined;
    }
    | {
        attributes?: undefined;
        delete: number;
        insert?: undefined;
        retain?: undefined;
    }
    | {
        attributes?: { [key in string]: {} };
        delete?: undefined;
        insert?: undefined;
        retain: number;
    }

Represents a Delta type which is a union of different operations that can be performed.

Type Parameters

  • T

T - The data type for the insert operation.

The Delta type can be one of three distinct shapes:

  1. Insert Operation:

    • insert: The item to be inserted, of type T.
    • attributes: (Optional) A dictionary of attributes, describing styles in richtext
  2. Delete Operation:

    • delete: The number of elements to delete.
  3. Retain Operation:

    • retain: The number of elements to retain.
    • attributes: (Optional) A dictionary of attributes, describing styles in richtext