import { GenericOp } from './operations' ; import Delta from 'quill-delta' ; import hasPath from 'ramda/es/hasPath' ; public export interface GenericRichContent { /**
     * An array of operations.
     */ readonly ops : GenericOp [ ] ; returns readonly length : ( ) => number ; } export function extractTextFromDelta ( delta ) { return delta . ops . reduce ( ( acc , curr ) => ( typeof curr . insert === 'string' ? acc + curr . insert : acc ) , '' ) ; } export function isGenericDelta ( arg ) { return arg && hasPath ( [ 'ops' ] , arg ) ; } export function isMutatingDelta ( delta ) { const iterator = Delta . Op . iterator ( delta . ops ) ; let shouldOverride = false ; while ( iterator . hasNext ( ) ) { const next = iterator . next ( ) ; if ( ! next . retain || next . attributes != null ) { shouldOverride = true ; break ; } } return shouldOverride ; }