BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
shortcuts.js
app/assets/javascripts/shortcuts.js
+5
-2
form-focus-previous-incorrect-form.yml
changelogs/unreleased/form-focus-previous-incorrect-form.yml
+4
-0
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';
Shortcuts
.
prototype
.
toggleMarkdownPreview
=
function
(
e
)
{
// Check if short-cut was triggered while in Write Mode
if
(
$
(
e
.
target
).
hasClass
(
'js-note-text'
))
{
$
(
'.js-md-preview-button'
).
focus
();
const
$target
=
$
(
e
.
target
);
const
$form
=
$target
.
closest
(
'form'
);
if
(
$target
.
hasClass
(
'js-note-text'
))
{
$
(
'.js-md-preview-button'
,
$form
).
focus
();
}
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