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
Kazuhiko Shiozaki
gitlab-ce
Commits
ca5d0c82
Commit
ca5d0c82
authored
Apr 11, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hotkey for "reply with selected text" to Issueable
parent
4603bf50
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
app/assets/javascripts/shortcuts_issueable.coffee
app/assets/javascripts/shortcuts_issueable.coffee
+27
-1
No files found.
app/assets/javascripts/shortcuts_issueable.coffee
View file @
ca5d0c82
...
@@ -11,9 +11,35 @@ class @ShortcutsIssueable extends ShortcutsNavigation
...
@@ -11,9 +11,35 @@ class @ShortcutsIssueable extends ShortcutsNavigation
$
(
'.js-milestone'
).
select2
(
'open'
)
$
(
'.js-milestone'
).
select2
(
'open'
)
return
false
return
false
)
)
Mousetrap
.
bind
(
'r'
,
=>
@
replyWithSelectedText
()
return
false
)
if
isMergeRequest
if
isMergeRequest
@
enabledHelp
.
push
(
'.hidden-shortcut.merge_requests'
)
@
enabledHelp
.
push
(
'.hidden-shortcut.merge_requests'
)
else
else
@
enabledHelp
.
push
(
'.hidden-shortcut.issues'
)
@
enabledHelp
.
push
(
'.hidden-shortcut.issues'
)
replyWithSelectedText
:
->
if
window
.
getSelection
selected
=
window
.
getSelection
().
toString
()
replyField
=
$
(
'.js-main-target-form #note_note'
)
return
if
selected
.
trim
()
==
""
# Put a '>' character before each non-empty line in the selection
quote
=
_
.
map
selected
.
split
(
"
\n
"
),
(
val
)
->
">
#{
val
}
\n
"
if
val
.
trim
()
!=
''
# If replyField already has some content, add a newline before our quote
separator
=
replyField
.
val
().
trim
()
!=
""
and
"
\n
"
or
''
replyField
.
val
(
_
,
current
)
->
current
+
separator
+
quote
.
join
(
''
)
+
"
\n
"
# Trigger autosave for the added text
replyField
.
trigger
(
'input'
)
# Focus the input field
replyField
.
focus
()
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