Commit bd3e1cdf authored by Jacob Schatz's avatar Jacob Schatz Committed by Robert Speicher

Merge branch 'add-shortcut-to-copy-file-content-hash-link' into 'master'

Add shortcut to copy file content hash link

## What does this MR do?

* Allows for multiple shortcut handlers to be initialised
* Adds `y` shortcut to file pages to copy permalink URL.

## Are there points in the code the reviewer needs to double check?

Ney.

## Why was this MR needed?

UX

## What are the relevant issue numbers?

Closes #14470.

## Screenshots (if relevant)

![y-shortcut](/uploads/b81feb26d8e0d7d4996c4afa29f385d7/y-shortcut.gif)

See merge request !4496
parent 063535be
......@@ -27,6 +27,7 @@ v 8.9.0 (unreleased)
- Add a metric for the number of new Redis connections created by a transaction
- Fix Error 500 when viewing a blob with binary characters after the 1024-byte mark
- Redesign navigation for project pages
- Added shortcut 'y' for copying a files content hash URL #14470
- Fix groups API to list only user's accessible projects
- Add Environments and Deployments
- Redesign account and email confirmation emails
......
......@@ -98,6 +98,7 @@ class Dispatcher
when 'projects:blob:show', 'projects:blame:show'
new LineHighlighter()
shortcut_handler = new ShortcutsNavigation()
new ShortcutsBlob true
when 'projects:labels:new', 'projects:labels:edit'
new Labels()
when 'projects:labels:index'
......
class @Shortcuts
constructor: ->
constructor: (skipResetBindings) ->
@enabledHelp = []
Mousetrap.reset()
Mousetrap.reset() if not skipResetBindings
Mousetrap.bind('?', @onToggleHelp)
Mousetrap.bind('s', Shortcuts.focusSearch)
Mousetrap.bind(['ctrl+shift+p', 'command+shift+p'], @toggleMarkdownPreview)
......
#= require shortcuts
class @ShortcutsBlob extends Shortcuts
constructor: (skipResetBindings) ->
super skipResetBindings
Mousetrap.bind('y', ShortcutsBlob.copyToClipboard)
@copyToClipboard: ->
clipboardButton = $('.btn-clipboard')
clipboardButton.click() if clipboardButton
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment