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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f6a3fa83
Commit
f6a3fa83
authored
Jan 27, 2021
by
Yogi
Committed by
Nathan Friend
Jan 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keyboard shortcut for switching to GitLab next (Canary)
parent
67d0cc39
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
1 deletion
+34
-1
app/assets/javascripts/behaviors/shortcuts/keybindings.js
app/assets/javascripts/behaviors/shortcuts/keybindings.js
+7
-0
app/assets/javascripts/behaviors/shortcuts/shortcuts.js
app/assets/javascripts/behaviors/shortcuts/shortcuts.js
+10
-1
app/views/help/_shortcuts.html.haml
app/views/help/_shortcuts.html.haml
+6
-0
changelogs/unreleased/yo-canary-shortcut.yml
changelogs/unreleased/yo-canary-shortcut.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+6
-0
No files found.
app/assets/javascripts/behaviors/shortcuts/keybindings.js
View file @
f6a3fa83
...
...
@@ -29,6 +29,7 @@ export const customizations = parsedCustomizations;
// All available commands
export
const
TOGGLE_PERFORMANCE_BAR
=
'
globalShortcuts.togglePerformanceBar
'
;
export
const
TOGGLE_CANARY
=
'
globalShortcuts.toggleCanary
'
;
/** All keybindings, grouped and ordered with descriptions */
export
const
keybindingGroups
=
[
...
...
@@ -42,6 +43,12 @@ export const keybindingGroups = [
// eslint-disable-next-line @gitlab/require-i18n-strings
defaultKeys
:
[
'
p b
'
],
},
{
description
:
s__
(
'
KeyboardShortcuts|Toggle GitLab Next
'
),
command
:
TOGGLE_CANARY
,
// eslint-disable-next-line @gitlab/require-i18n-strings
defaultKeys
:
[
'
g x
'
],
},
],
},
]
...
...
app/assets/javascripts/behaviors/shortcuts/shortcuts.js
View file @
f6a3fa83
...
...
@@ -9,7 +9,7 @@ import axios from '../../lib/utils/axios_utils';
import
{
refreshCurrentPage
,
visitUrl
}
from
'
../../lib/utils/url_utility
'
;
import
findAndFollowLink
from
'
../../lib/utils/navigation_utility
'
;
import
{
parseBoolean
,
getCspNonceValue
}
from
'
~/lib/utils/common_utils
'
;
import
{
keysFor
,
TOGGLE_PERFORMANCE_BAR
}
from
'
./keybindings
'
;
import
{
keysFor
,
TOGGLE_PERFORMANCE_BAR
,
TOGGLE_CANARY
}
from
'
./keybindings
'
;
const
defaultStopCallback
=
Mousetrap
.
prototype
.
stopCallback
;
Mousetrap
.
prototype
.
stopCallback
=
function
customStopCallback
(
e
,
element
,
combo
)
{
...
...
@@ -72,6 +72,7 @@ export default class Shortcuts {
Mousetrap
.
bind
(
'
/
'
,
Shortcuts
.
focusSearch
);
Mousetrap
.
bind
(
'
f
'
,
this
.
focusFilter
.
bind
(
this
));
Mousetrap
.
bind
(
keysFor
(
TOGGLE_PERFORMANCE_BAR
),
Shortcuts
.
onTogglePerfBar
);
Mousetrap
.
bind
(
keysFor
(
TOGGLE_CANARY
),
Shortcuts
.
onToggleCanary
);
const
findFileURL
=
document
.
body
.
dataset
.
findFile
;
...
...
@@ -124,6 +125,14 @@ export default class Shortcuts {
refreshCurrentPage
();
}
static
onToggleCanary
(
e
)
{
e
.
preventDefault
();
const
canaryCookieName
=
'
gitlab_canary
'
;
const
currentValue
=
parseBoolean
(
Cookies
.
get
(
canaryCookieName
));
Cookies
.
set
(
canaryCookieName
,
(
!
currentValue
).
toString
(),
{
expires
:
365
,
path
:
'
/
'
});
refreshCurrentPage
();
}
static
toggleMarkdownPreview
(
e
)
{
// Check if short-cut was triggered while in Write Mode
const
$target
=
$
(
e
.
target
);
...
...
app/views/help/_shortcuts.html.haml
View file @
f6a3fa83
...
...
@@ -60,6 +60,12 @@
%kbd
p
%kbd
b
%td
=
_
(
'Toggle the Performance Bar'
)
-
if
Gitlab
.
com?
%tr
%td
.shortcut
%kbd
g
%kbd
x
%td
=
_
(
'Toggle GitLab Next'
)
%tbody
%tr
%th
...
...
changelogs/unreleased/yo-canary-shortcut.yml
0 → 100644
View file @
f6a3fa83
---
title
:
Keyboard shortcut for switching to GitLab next (Canary)
merge_request
:
51834
author
:
Yogi (@yo)
type
:
added
locale/gitlab.pot
View file @
f6a3fa83
...
...
@@ -16406,6 +16406,9 @@ msgstr ""
msgid "KeyboardShortcuts|Global Shortcuts"
msgstr ""
msgid "KeyboardShortcuts|Toggle GitLab Next"
msgstr ""
msgid "KeyboardShortcuts|Toggle the Performance Bar"
msgstr ""
...
...
@@ -29907,6 +29910,9 @@ msgstr ""
msgid "Today"
msgstr ""
msgid "Toggle GitLab Next"
msgstr ""
msgid "Toggle Markdown preview"
msgstr ""
...
...
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