Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
115d1afe
Commit
115d1afe
authored
Apr 07, 2017
by
Luke "Jared" Bennett
Committed by
Phil Hughes
Apr 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only add newlines for multiple uploads
parent
3c9318a8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
app/assets/javascripts/dropzone_input.js
app/assets/javascripts/dropzone_input.js
+7
-3
changelogs/unreleased/remove-double-newline-for-single-attachments.yml
...released/remove-double-newline-for-single-attachments.yml
+4
-0
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+2
-2
No files found.
app/assets/javascripts/dropzone_input.js
View file @
115d1afe
...
@@ -66,7 +66,10 @@ window.DropzoneInput = (function() {
...
@@ -66,7 +66,10 @@ window.DropzoneInput = (function() {
form_textarea
.
focus
();
form_textarea
.
focus
();
},
},
success
:
function
(
header
,
response
)
{
success
:
function
(
header
,
response
)
{
pasteText
(
response
.
link
.
markdown
);
const
processingFileCount
=
this
.
getQueuedFiles
().
length
+
this
.
getUploadingFiles
().
length
;
const
shouldPad
=
processingFileCount
>=
1
;
pasteText
(
response
.
link
.
markdown
,
shouldPad
);
},
},
error
:
function
(
temp
)
{
error
:
function
(
temp
)
{
var
checkIfMsgExists
,
errorAlert
;
var
checkIfMsgExists
,
errorAlert
;
...
@@ -123,9 +126,10 @@ window.DropzoneInput = (function() {
...
@@ -123,9 +126,10 @@ window.DropzoneInput = (function() {
}
}
return
false
;
return
false
;
};
};
pasteText
=
function
(
text
)
{
pasteText
=
function
(
text
,
shouldPad
)
{
var
afterSelection
,
beforeSelection
,
caretEnd
,
caretStart
,
textEnd
;
var
afterSelection
,
beforeSelection
,
caretEnd
,
caretStart
,
textEnd
;
var
formattedText
=
text
+
"
\n\n
"
;
var
formattedText
=
text
;
if
(
shouldPad
)
formattedText
+=
"
\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
;
...
...
changelogs/unreleased/remove-double-newline-for-single-attachments.yml
0 → 100644
View file @
115d1afe
---
title
:
Only add newlines between multiple uploads
merge_request
:
10545
author
:
spec/features/issues_spec.rb
View file @
115d1afe
...
@@ -601,10 +601,10 @@ describe 'Issues', feature: true do
...
@@ -601,10 +601,10 @@ 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
it
"doesn't add double newline to end of a single attachment markdown"
do
dropzone_file
Rails
.
root
.
join
(
'spec'
,
'fixtures'
,
'banana_sample.gif'
)
dropzone_file
Rails
.
root
.
join
(
'spec'
,
'fixtures'
,
'banana_sample.gif'
)
expect
(
page
.
find_field
(
"issue_description"
).
value
).
to
match
/\n\n$/
expect
(
page
.
find_field
(
"issue_description"
).
value
).
not_
to
match
/\n\n$/
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment