Commits

ben...@pollen  committed 199158f

fix bug in ie

  • Participants
  • Parent commits 7cc6c8e

Comments (0)

Files changed (1)

File static/js/src/editor.js

 		if (begin_line == "\n" || begin_line == "\r" || begin_line.length == 0) 
 			return false;
 
-        if (base2.detect("MSIE") || base2.detect("opera")) {
+        if (base2.detect("MSIE") || base2.detect("opera")) {
             begin_line = "\r\n" + begin_line;
         } else {
             begin_line = "\n" + begin_line;
         this.el.focus();
         var start_range = this.el.createTextRange();
         var end_range = start_range.duplicate();
-        end_range.collapse(true);
         start_range.moveToBookmark(document.selection.createRange().getBookmark());
 	    start_range.moveEnd('character', this.el.value.length);
 	    this.el.selectionStart = this.el.value.length - start_range.text.length;
 	    end_range.moveToBookmark(document.selection.createRange().getBookmark());
 	    end_range.moveStart('character', - this.el.value.length);
 	    this.el.selectionEnd = end_range.text.length;
+        if (this.el.selectionEnd < this.el.selectionStart)
+            this.el.selectionEnd = this.el.selectionStart;
+        
     },
     
     _setIESelection: function() {