Skip to content
Snippets Groups Projects
Verified Commit 9f322f2b authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett
Browse files

Added double newline after file upload markdown insert

parent 459a97d4
Branches
Tags
1 merge request!9430Added double newline after file upload markdown insert
Pipeline #
Loading
@@ -126,13 +126,14 @@ require('./preview_markdown');
Loading
@@ -126,13 +126,14 @@ require('./preview_markdown');
}; };
pasteText = function(text) { pasteText = function(text) {
var afterSelection, beforeSelection, caretEnd, caretStart, textEnd; var afterSelection, beforeSelection, caretEnd, caretStart, textEnd;
var formattedText = text + "\n\n";
caretStart = $(child)[0].selectionStart; caretStart = $(child)[0].selectionStart;
caretEnd = $(child)[0].selectionEnd; caretEnd = $(child)[0].selectionEnd;
textEnd = $(child).val().length; textEnd = $(child).val().length;
beforeSelection = $(child).val().substring(0, caretStart); beforeSelection = $(child).val().substring(0, caretStart);
afterSelection = $(child).val().substring(caretEnd, textEnd); afterSelection = $(child).val().substring(caretEnd, textEnd);
$(child).val(beforeSelection + text + afterSelection); $(child).val(beforeSelection + formattedText + afterSelection);
child.get(0).setSelectionRange(caretStart + text.length, caretEnd + text.length); child.get(0).setSelectionRange(caretStart + formattedText.length, caretEnd + formattedText.length);
return form_textarea.trigger("input"); return form_textarea.trigger("input");
}; };
getFilename = function(e) { getFilename = function(e) {
Loading
Loading
Loading
@@ -577,6 +577,15 @@ describe 'Issues', feature: true do
Loading
@@ -577,6 +577,15 @@ describe 'Issues', feature: true do
   
expect(page.find_field("issue_description").value).to have_content 'banana_sample' expect(page.find_field("issue_description").value).to have_content 'banana_sample'
end 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
end end
   
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment