import { Attributes } from './attributes' ; import Op from 'quill-delta/dist/Op' ; import reduce from 'ramda/es/reduce' ; import { Images } from '@core/Images' ; remarks This interface is a redefinition of  quilljs-delta .
 *
 *  public export interface GenericOp { /**
     * A representation of inserted content.
     */ readonly insert ? : string | object ; internal readonly delete ? : number ; internal readonly retain ? : number ; /**
     * A set of attributes describing properties of the content.
     */ readonly attributes ? : Attributes . Map ; } public export interface TextOp extends GenericOp { /**
     * {@inheritdoc GenericOp.insert}
     */ readonly insert ? : string ; /**
     * {@inheritdoc GenericOp.attributes}
     */ readonly attributes ? : Attributes . Map ; } public export interface ImageKind < Source > extends Images . Description < Source > { kind : 'image' ; } public export type ImageOp < Source > = BlockOp < ImageKind < Source > > ; public export interface BlockOp < T extends object > extends GenericOp { /**
     * {@inheritdoc GenericOp.insert}
     */ readonly insert : T ; /**
     * {@inheritdoc GenericOp.attributes}
     */ readonly attributes ? : Attributes . Map ; } export function isTextOp ( op ) { return typeof op . insert === 'string' ; } export const computeOpsLength = reduce ( ( curr , prev ) => Op . length ( prev ) + curr , 0 as number ) ; export function buildTextOp ( text , attributes ? ) { return attributes ? { insert : text , attributes , } : { insert : text } ; } export function buildImageOp < Source > ( description ) { return { insert : { kind : 'image' , ... description , } , } ; }