Commit 1731f45e authored by Jacob Schatz's avatar Jacob Schatz

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 👍 

Fixes #12822 

cc. @jschatz1 

See merge request !2648
parents 7b8ad807 76534e77
......@@ -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) ->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment