lib/ace-adapter.js
// and returns them as a two-element array.
and returns them as a two-element array.
and returns them as a two - element array .
operationFromACEChange(change) {
      var action, delete_op, delta, insert_op, ref, restLength, start, text;
      if (change.data) {
        delta = change.data;
        if ((ref = delta.action) === 'insertLines' || ref === 'removeLines') {
          text = delta.lines.join('\n') + '\n';
          action = delta.action.replace('Lines', '');
        } else {
          text = delta.text.replace(this.aceDoc.getNewLineCharacter(), '\n');
          action = delta.action.replace('Text', '');
        }
        start = this.indexFromPos(delta.range.start);
      } else {
        text = change.lines.join('\n');
        start = this.indexFromPos(change.start);
      }
      restLength = this.lastDocLines.join('\n').length - start;
      if (change.action === 'remove') {
        restLength -= text.length;
      }
      insert_op = new firepad.TextOperation().retain(start).insert(text).retain(restLength);
      delete_op = new firepad.TextOperation().retain(start).delete(text).retain(restLength);
      if (change.action === 'remove') {
        return [delete_op, insert_op];
      } else {
        return [insert_op, delete_op];
      }
    }
operationFromACEChange ( change ) { var action , delete_op , delta , insert_op , ref , restLength , start , text ; if ( change . data ) { delta = change . data ; if ( ( ref = delta . action ) === 'insertLines' || ref === 'removeLines' ) { text = delta . lines . join ( '\n' ) + '\n' ; action = delta . action . replace ( 'Lines' , '' ) ; } else { text = delta . text . replace ( this . aceDoc . getNewLineCharacter ( ) , '\n' ) ; action = delta . action . replace ( 'Text' , '' ) ; } start = this . indexFromPos ( delta . range . start ) ; } else { text = change . lines . join ( '\n' ) ; start = this . indexFromPos ( change . start ) ; } restLength = this . lastDocLines . join ( '\n' ) . length - start ; if ( change . action === 'remove' ) { restLength -= text . length ; } insert_op = new firepad . TextOperation ( ) . retain ( start ) . insert ( text ) . retain ( restLength ) ; delete_op = new firepad . TextOperation ( ) . retain ( start ) . delete ( text ) . retain ( restLength ) ; if ( change . action === 'remove' ) { return [ delete_op , insert_op ] ; } else { return [ insert_op , delete_op ] ; } }
and returns them as a two-element array.
and returns them as a two - element array .
// Ace < 1.2.0 // Ace 1.2.0+