summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2016-04-16 16:08:53 -0400
committerJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2016-04-16 16:08:53 -0400
commitdd0478656d877bea84a313826258f1a35f9b1ab4 (patch)
tree4a353609f08ee79278a66aba92ddb70da1917a2d
parent262ca7b651037e02d0de662b6462fe4edfa77e81 (diff)
downloadgitlab-ce-edit-last-comment.tar.gz
Add move cursor to last character for editing comment also.edit-last-comment
-rw-r--r--app/assets/javascripts/notes.js.coffee13
1 files changed, 9 insertions, 4 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index c2e103ff857..82e210fed7d 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -366,6 +366,11 @@ class @Notes
# Show the attachment delete link
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
if scrollTo? and myLastNote?
# scroll to the bottom
@@ -376,12 +381,12 @@ class @Notes
}, 500, ->
$noteText = form.find(".js-note-text")
$noteText.focus()
- # Neat little trick to put the cursor at the end
- noteTextVal = $noteText.val()
- $noteText.val('').val(noteTextVal);
+ done($noteText)
);
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