Skip to content
Snippets Groups Projects
Commit fc334e72 authored by Phil Hughes's avatar Phil Hughes
Browse files

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
Branches
Tags
1 merge request!2648Adds the markdown link at the cursor poisition
Loading
@@ -65,8 +65,13 @@ class @DropzoneInput
Loading
@@ -65,8 +65,13 @@ class @DropzoneInput
return return
   
success: (header, response) -> success: (header, response) ->
link_markdown = response.link.markdown
child = $(dropzone[0]).children("textarea") 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 return
   
error: (temp, errorMessage) -> error: (temp, errorMessage) ->
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment