Add move cursor to last character for editing comment also.

This commit is contained in:
Jacob Schatz 2016-04-16 16:08:53 -04:00
parent 262ca7b651
commit dd0478656d
1 changed files with 9 additions and 4 deletions

View File

@ -366,6 +366,11 @@ class @Notes
# Show the attachment delete link # Show the attachment delete link
note.find(".js-note-attachment-delete").show() note.find(".js-note-attachment-delete").show()
done = ($noteText) ->
# Neat little trick to put the cursor at the end
noteTextVal = $noteText.val()
$noteText.val('').val(noteTextVal);
new GLForm form new GLForm form
if scrollTo? and myLastNote? if scrollTo? and myLastNote?
# scroll to the bottom # scroll to the bottom
@ -376,12 +381,12 @@ class @Notes
}, 500, -> }, 500, ->
$noteText = form.find(".js-note-text") $noteText = form.find(".js-note-text")
$noteText.focus() $noteText.focus()
# Neat little trick to put the cursor at the end done($noteText)
noteTextVal = $noteText.val()
$noteText.val('').val(noteTextVal);
); );
else else
form.find(".js-note-text").focus() $noteText = form.find('.js-note-text')
$noteText.focus()
done($noteText)
### ###
Called in response to clicking the edit note link Called in response to clicking the edit note link