mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 17:05:51 +01:00
move cursor to end
This commit is contained in:
@@ -122,8 +122,8 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
|
|||||||
composer.newReply(tid, pid, title, '[[modules:composer.user_said, ' + username + ']]' + text);
|
composer.newReply(tid, pid, title, '[[modules:composer.user_said, ' + username + ']]' + text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var postContainer = $('#cmp-uuid-' + uuid);
|
||||||
var bodyEl = $('#cmp-uuid-'+uuid).find('textarea');
|
var bodyEl = postContainer.find('textarea');
|
||||||
var prevText = bodyEl.val();
|
var prevText = bodyEl.val();
|
||||||
if(tid !== composer.posts[uuid].tid) {
|
if(tid !== composer.posts[uuid].tid) {
|
||||||
var link = '[' + title + '](/topic/' + tid + '#' + pid + ')';
|
var link = '[' + title + '](/topic/' + tid + '#' + pid + ')';
|
||||||
@@ -135,7 +135,8 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
|
|||||||
function onTranslated(translated) {
|
function onTranslated(translated) {
|
||||||
composer.posts[uuid].body = (prevText.length ? prevText + '\n\n' : '') + translated + text;
|
composer.posts[uuid].body = (prevText.length ? prevText + '\n\n' : '') + translated + text;
|
||||||
bodyEl.val(composer.posts[uuid].body);
|
bodyEl.val(composer.posts[uuid].body);
|
||||||
preview.render($('#cmp-uuid-' + uuid));
|
focusElements(postContainer);
|
||||||
|
preview.render(postContainer);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -328,9 +329,7 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
|
|||||||
bodyEl = postContainer.find('textarea');
|
bodyEl = postContainer.find('textarea');
|
||||||
|
|
||||||
if (title.is(':disabled')) {
|
if (title.is(':disabled')) {
|
||||||
bodyEl.focus();
|
bodyEl.focus().putCursorAtEnd();
|
||||||
bodyEl.selectionStart = bodyEl.val().length;
|
|
||||||
bodyEl.selectionEnd = bodyEl.val().length;
|
|
||||||
} else {
|
} else {
|
||||||
title.focus();
|
title.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user