Shave a line, fix firefox leaving the text selected when quoting opens the QR. (wtf?)

This commit is contained in:
Nicolas Stepien 2011-12-06 21:19:55 +01:00
parent 667cb36461
commit ccad16264d
2 changed files with 2 additions and 4 deletions

View File

@ -1667,8 +1667,7 @@
ta = $('textarea', qr.el);
ta.value = ta.value.slice(0, ta.selectionStart) + text + ta.value.slice(ta.selectionEnd, ta.value.length);
ta.focus();
ta.selectionEnd = ta.selectionStart + text.length;
return window.getSelection().collapseToEnd();
return ta.selectionStart = ta.selectionEnd = ta.selectionStart + text.length;
},
refresh: function() {
var m, newFile, oldFile, _ref;

View File

@ -1305,8 +1305,7 @@ qr =
ta.value = ta.value.slice(0, ta.selectionStart) + text + ta.value.slice(ta.selectionEnd, ta.value.length)
ta.focus()
#move the caret to the end of the new quote
ta.selectionEnd = ta.selectionStart + text.length
window.getSelection().collapseToEnd()
ta.selectionStart = ta.selectionEnd = ta.selectionStart + text.length
refresh: ->
$('[name=sub]', qr.el).value = ''