Skip to content

Commit

Permalink
move cursor to end
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Jun 29, 2014
1 parent 105acc0 commit c9c68f8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions public/src/modules/composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
composer.newReply(tid, pid, title, '[[modules:composer.user_said, ' + username + ']]' + text);
return;
}

var bodyEl = $('#cmp-uuid-'+uuid).find('textarea');
var postContainer = $('#cmp-uuid-' + uuid);
var bodyEl = postContainer.find('textarea');
var prevText = bodyEl.val();
if(tid !== composer.posts[uuid].tid) {
var link = '[' + title + '](/topic/' + tid + '#' + pid + ')';
Expand All @@ -135,7 +135,8 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
function onTranslated(translated) {
composer.posts[uuid].body = (prevText.length ? prevText + '\n\n' : '') + translated + text;
bodyEl.val(composer.posts[uuid].body);
preview.render($('#cmp-uuid-' + uuid));
focusElements(postContainer);
preview.render(postContainer);
}
};

Expand Down Expand Up @@ -328,9 +329,7 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
bodyEl = postContainer.find('textarea');

if (title.is(':disabled')) {
bodyEl.focus();
bodyEl.selectionStart = bodyEl.val().length;
bodyEl.selectionEnd = bodyEl.val().length;
bodyEl.focus().putCursorAtEnd();
} else {
title.focus();
}
Expand Down

0 comments on commit c9c68f8

Please sign in to comment.