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
This commit is contained in:
commit
1731f45e2b
|
@ -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) ->
|
||||
|
|
Loading…
Reference in New Issue