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
b8a96fda
Commit
b8a96fda
authored
Apr 21, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the preview keyboard shortcut focusing wrong tab
Closes #31101
parent
f09f7539
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
app/assets/javascripts/shortcuts.js
app/assets/javascripts/shortcuts.js
+5
-2
changelogs/unreleased/form-focus-previous-incorrect-form.yml
changelogs/unreleased/form-focus-previous-incorrect-form.yml
+4
-0
spec/javascripts/shortcuts_spec.js
spec/javascripts/shortcuts_spec.js
+29
-0
No files found.
app/assets/javascripts/shortcuts.js
View file @
b8a96fda
...
@@ -57,8 +57,11 @@ import findAndFollowLink from './shortcuts_dashboard_navigation';
...
@@ -57,8 +57,11 @@ import findAndFollowLink from './shortcuts_dashboard_navigation';
Shortcuts
.
prototype
.
toggleMarkdownPreview
=
function
(
e
)
{
Shortcuts
.
prototype
.
toggleMarkdownPreview
=
function
(
e
)
{
// Check if short-cut was triggered while in Write Mode
// Check if short-cut was triggered while in Write Mode
if
(
$
(
e
.
target
).
hasClass
(
'
js-note-text
'
))
{
const
$target
=
$
(
e
.
target
);
$
(
'
.js-md-preview-button
'
).
focus
();
const
$form
=
$target
.
closest
(
'
form
'
);
if
(
$target
.
hasClass
(
'
js-note-text
'
))
{
$
(
'
.js-md-preview-button
'
,
$form
).
focus
();
}
}
return
$
(
document
).
triggerHandler
(
'
markdown-preview:toggle
'
,
[
e
]);
return
$
(
document
).
triggerHandler
(
'
markdown-preview:toggle
'
,
[
e
]);
};
};
...
...
changelogs/unreleased/form-focus-previous-incorrect-form.yml
0 → 100644
View file @
b8a96fda
---
title
:
Fixued preview shortcut focusing wrong preview tab
merge_request
:
author
:
spec/javascripts/shortcuts_spec.js
0 → 100644
View file @
b8a96fda
/* global Shortcuts */
describe
(
'
Shortcuts
'
,
()
=>
{
const
fixtureName
=
'
issues/open-issue.html.raw
'
;
preloadFixtures
(
fixtureName
);
describe
(
'
toggleMarkdownPreview
'
,
()
=>
{
let
sc
;
let
event
;
beforeEach
(()
=>
{
loadFixtures
(
fixtureName
);
spyOnEvent
(
'
.js-md-preview-button
'
,
'
focus
'
);
event
=
$
.
Event
(
''
,
{
target
:
document
.
querySelector
(
'
.js-note-text
'
),
});
sc
=
new
Shortcuts
();
});
it
(
'
focuses preview button in form
'
,
()
=>
{
sc
.
toggleMarkdownPreview
(
event
);
expect
(
'
focus
'
).
toHaveBeenTriggeredOn
(
'
.js-md-preview-button
'
);
});
});
});
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