Commit fc334e72 authored by Phil Hughes's avatar Phil Hughes

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

Fixes #12822
parent f5860ce6
......@@ -65,8 +65,13 @@ class @DropzoneInput
return
success: (header, response) ->
link_markdown = response.link.markdown
child = $(dropzone[0]).children("textarea")
$(child).val $(child).val() + response.link.markdown + "\n"
cursor_pos = child.prop "selectionStart"
value = $(child).val()
new_text = "#{value.substring(0, cursor_pos)}#{link_markdown}#{value.substring(cursor_pos, value.length)}"
$(child).val new_text + "\n"
return
error: (temp, errorMessage) ->
......
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