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
Tatuya Kamada
gitlab-ce
Commits
cb2093fb
Commit
cb2093fb
authored
Feb 03, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8702 from m-a-r-c-o/raw-image-paste-fix
Fix raw image paste from clipboard
parents
704922c8
7b3fd031
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
19 deletions
+14
-19
CHANGELOG
CHANGELOG
+1
-1
app/assets/javascripts/dropzone_input.js.coffee
app/assets/javascripts/dropzone_input.js.coffee
+13
-18
No files found.
CHANGELOG
View file @
cb2093fb
...
...
@@ -42,7 +42,7 @@ v 7.8.0
- Password reset token validity increased from 2 hours to 2 days since it is also send on account creation.
-
-
-
-
Enable raw image paste from clipboard, currently Chrome only (Marco Cyriacks)
-
-
- Add action property to merge request hook (Julien Bianchi)
...
...
app/assets/javascripts/dropzone_input.js.coffee
View file @
cb2093fb
...
...
@@ -13,6 +13,8 @@ class @DropzoneInput
form_textarea
=
$
(
form
).
find
(
"textarea.markdown-area"
)
form_textarea
.
wrap
"<div class=
\"
div-dropzone
\"
></div>"
form_textarea
.
bind
'paste'
,
(
event
)
=>
handlePaste
(
event
)
form_dropzone
=
$
(
form
).
find
(
'.div-dropzone'
)
form_dropzone
.
parent
().
addClass
"div-dropzone-wrapper"
...
...
@@ -133,25 +135,18 @@ class @DropzoneInput
formatLink
=
(
str
)
->
"!["
+
str
.
alt
+
"]("
+
str
.
url
+
")"
handlePaste
=
(
e
)
->
e
.
preventDefault
()
my_event
=
e
.
originalEvent
if
my_event
.
clipboardData
and
my_event
.
clipboardData
.
items
processItem
(
my_event
)
processItem
=
(
e
)
->
image
=
isImage
(
e
)
handlePaste
=
(
event
)
->
pasteEvent
=
event
.
originalEvent
if
pasteEvent
.
clipboardData
and
pasteEvent
.
clipboardData
.
items
image
=
isImage
(
pasteEvent
)
if
image
filename
=
getFilename
(
e
)
or
"image.png"
event
.
preventDefault
()
filename
=
getFilename
(
pasteEvent
)
or
"image.png"
text
=
"{{"
+
filename
+
"}}"
pasteText
(
text
)
uploadFile
image
.
getAsFile
(),
filename
else
text
=
e
.
clipboardData
.
getData
(
"text/plain"
)
pasteText
(
text
)
isImage
=
(
data
)
->
i
=
0
while
i
<
data
.
clipboardData
.
items
.
length
...
...
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