diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-02-21 22:48:02 +0000 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-02-22 18:05:51 +0000 |
commit | 9f322f2b3866833af1bca7ecd3624428d968b017 (patch) | |
tree | cb026056b7d1edc798dda11dd1804ec23121b230 | |
parent | 459a97d46812fecc59c973bad356935422c7f60e (diff) | |
download | gitlab-ce-9f322f2b3866833af1bca7ecd3624428d968b017.tar.gz |
Added double newline after file upload markdown insert
-rw-r--r-- | app/assets/javascripts/dropzone_input.js | 5 | ||||
-rw-r--r-- | spec/features/issues_spec.rb | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js index 64a7a9eaf37..646f836aff0 100644 --- a/app/assets/javascripts/dropzone_input.js +++ b/app/assets/javascripts/dropzone_input.js @@ -126,13 +126,14 @@ require('./preview_markdown'); }; pasteText = function(text) { var afterSelection, beforeSelection, caretEnd, caretStart, textEnd; + var formattedText = text + "\n\n"; caretStart = $(child)[0].selectionStart; caretEnd = $(child)[0].selectionEnd; textEnd = $(child).val().length; 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); + $(child).val(beforeSelection + formattedText + afterSelection); + child.get(0).setSelectionRange(caretStart + formattedText.length, caretEnd + formattedText.length); return form_textarea.trigger("input"); }; getFilename = function(e) { diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 094f645a077..ed3826bd46e 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -577,6 +577,15 @@ describe 'Issues', feature: true do expect(page.find_field("issue_description").value).to have_content 'banana_sample' end + + it 'adds double newline to end of attachment markdown' do + drop_in_dropzone test_image_file + + # Wait for the file to upload + sleep 1 + + expect(page.find_field("issue_description").value).to match /\n\n$/ + end end end |