public/javascripts/codemirror/js/editor.js
function() {
      var h = this.history;
      h.commit();

      var start = select.cursorPos(this.container, true),
          end = select.cursorPos(this.container, false);
      if (!start || !end) return "";

      if (start.node == end.node)
        return h.textAfter(start.node).slice(start.offset, end.offset);

      var text = [h.textAfter(start.node).slice(start.offset)];
      for (var pos = h.nodeAfter(start.node); pos != end.node; pos = h.nodeAfter(pos))
        text.push(h.textAfter(pos));
      text.push(h.textAfter(end.node).slice(0, end.offset));
      return cleanText(text.join("\n"));
    }
function() {
      var h = this.history;
      h.commit();

      var start = select.cursorPos(this.container, true),
          end = select.cursorPos(this.container, false);
      if (!start || !end) return "";

      if (start.node == end.node)
        return h.textAfter(start.node).slice(start.offset, end.offset);

      var text = [h.textAfter(start.node).slice(start.offset)];
      for (var pos = h.nodeAfter(start.node); pos != end.node; pos = h.nodeAfter(pos))
        text.push(h.textAfter(pos));
      text.push(h.textAfter(end.node).slice(0, end.offset));
      return cleanText(text.join("\n"));
    }
function ( ) { var h = this . history ; h . commit ( ) ; var start = select . cursorPos ( this . container , true ) , end = select . cursorPos ( this . container , false ) ; if ( ! start || ! end ) return "" ; if ( start . node == end . node ) return h . textAfter ( start . node ) . slice ( start . offset , end . offset ) ; var text = [ h . textAfter ( start . node ) . slice ( start . offset ) ] ; for ( var pos = h . nodeAfter ( start . node ) ; pos != end . node ; pos = h . nodeAfter ( pos ) ) text . push ( h . textAfter ( pos ) ) ; text . push ( h . textAfter ( end . node ) . slice ( 0 , end . offset ) ) ; return cleanText ( text . join ( "\n" ) ) ; }
Retrieve the selected text.
Retrieve the selected text .