src/edit/history.js
// Record a transformation in undo history.
Record a transformation in undo history.
Record a transformation in undo history .
recordTransform(transform, options) {
    if (this.ignoreTransform) return
    if (options.addToHistory == false) {
      for (let i = 0; i < transform.maps.length; i++) {
        let map = transform.maps[i]
        this.done.addMap(map)
        this.undone.addMap(map)
      }
    } else {
      this.undone.clear()
      let now = Date.now()
      if (now > this.lastAddedAt + this.pm.options.historyEventDelay)
        this.done.newEvent()
      this.done.addTransform(transform)
      this.lastAddedAt = now
    }
    this.maybeScheduleCompression()
  }
recordTransform ( transform , options ) { if ( this . ignoreTransform ) return if ( options . addToHistory == false ) { for ( let i = 0 ; i < transform . maps . length ; i ++ ) { let map = transform . maps [ i ] this . done . addMap ( map ) this . undone . addMap ( map ) } } else { this . undone . clear ( ) let now = Date . now ( ) if ( now > this . lastAddedAt + this . pm . options . historyEventDelay ) this . done . newEvent ( ) this . done . addTransform ( transform ) this . lastAddedAt = now } this . maybeScheduleCompression ( ) }
Record a transformation in undo history.
Record a transformation in undo history .