diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2016-02-03 19:56:45 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2016-02-03 19:56:45 +0000 |
commit | 1731f45e2b27058178619b09df1473a041e024dd (patch) | |
tree | 62943af8de07112cbb268565dba71dec0f2dcee9 | |
parent | 7b8ad807770ab920f6d7852f2ab722eeb25c9fef (diff) | |
parent | 76534e776e76ef868de7f41fa03bc933882a7b1e (diff) | |
download | gitlab-ce-1731f45e2b27058178619b09df1473a041e024dd.tar.gz |
Merge branch 'attach-file-cursor-position' into 'master'
Adds the markdown link at the cursor poisition
When writing a comment and then dropping an image it will correctly add the image markdown link at the cursor position
![drop-image-markdown](/uploads/52f41e38faca48c9ee01a02a75ec71be/drop-image-markdown.gif)
Tested in Chrome & Firefox and both working fine :thumbsup:
Fixes #12822
cc. @jschatz1
See merge request !2648
-rw-r--r-- | app/assets/javascripts/dropzone_input.js.coffee | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/assets/javascripts/dropzone_input.js.coffee b/app/assets/javascripts/dropzone_input.js.coffee index c714c0fa939..b502131a99d 100644 --- a/app/assets/javascripts/dropzone_input.js.coffee +++ b/app/assets/javascripts/dropzone_input.js.coffee @@ -65,8 +65,7 @@ class @DropzoneInput return success: (header, response) -> - child = $(dropzone[0]).children("textarea") - $(child).val $(child).val() + response.link.markdown + "\n" + pasteText response.link.markdown return error: (temp, errorMessage) -> @@ -128,6 +127,7 @@ class @DropzoneInput beforeSelection = $(child).val().substring 0, caretStart afterSelection = $(child).val().substring caretEnd, textEnd $(child).val beforeSelection + text + afterSelection + child.get(0).setSelectionRange caretStart + text.length, caretEnd + text.length form_textarea.trigger "input" getFilename = (e) -> |