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
2cc82cbf
Commit
2cc82cbf
authored
Aug 20, 2019
by
Natalia Tepluhina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close design on escape button
- added Mousetrap to bind escape keypress
parent
dd692733
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
4 deletions
+30
-4
ee/app/assets/javascripts/design_management/components/design_notes/design_reply_form.vue
..._management/components/design_notes/design_reply_form.vue
+1
-1
ee/app/assets/javascripts/design_management/pages/design/index.vue
...sets/javascripts/design_management/pages/design/index.vue
+12
-0
ee/changelogs/unreleased/12777-pressing-escape-should-close-the-designs.yml
...leased/12777-pressing-escape-should-close-the-designs.yml
+5
-0
ee/spec/frontend/design_management/components/design_notes/design_reply_form_spec.js
...agement/components/design_notes/design_reply_form_spec.js
+2
-2
ee/spec/frontend/design_management/pages/design/index_spec.js
...pec/frontend/design_management/pages/design/index_spec.js
+5
-1
ee/spec/frontend/design_management/router_spec.js
ee/spec/frontend/design_management/router_spec.js
+5
-0
No files found.
ee/app/assets/javascripts/design_management/components/design_notes/design_reply_form.vue
View file @
2cc82cbf
...
...
@@ -59,7 +59,7 @@ export default {
@
input=
"$emit('input', $event.target.value)"
@
keydown.meta.enter=
"submitForm"
@
keydown.ctrl.enter=
"submitForm"
@
key
down.esc.exact
=
"$emit('cancelForm')"
@
key
up.esc.stop
=
"$emit('cancelForm')"
>
</textarea>
</markdown-field>
...
...
ee/app/assets/javascripts/design_management/pages/design/index.vue
View file @
2cc82cbf
<
script
>
import
Mousetrap
from
'
mousetrap
'
;
import
createFlash
from
'
~/flash
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
...
...
@@ -83,6 +84,12 @@ export default {
return
this
.
discussions
.
length
||
this
.
annotationCoordinates
;
},
},
mounted
()
{
Mousetrap
.
bind
(
'
esc
'
,
this
.
closeDesign
);
},
beforeDestroy
()
{
Mousetrap
.
unbind
(
'
esc
'
,
this
.
closeDesign
);
},
methods
:
{
addImageDiffNote
()
{
const
{
x
,
y
,
width
,
height
}
=
this
.
annotationCoordinates
;
...
...
@@ -167,6 +174,11 @@ export default {
this
.
overlayDimensions
.
width
=
position
.
width
;
this
.
overlayDimensions
.
height
=
position
.
height
;
},
closeDesign
()
{
// This needs to be changed to take a design version into account as soon as
// https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/15119 is merged
this
.
$router
.
push
(
'
/designs
'
);
},
},
beforeRouteUpdate
(
to
,
from
,
next
)
{
this
.
closeCommentForm
();
...
...
ee/changelogs/unreleased/12777-pressing-escape-should-close-the-designs.yml
0 → 100644
View file @
2cc82cbf
---
title
:
Pressing the Escape key now closes designs in Design Management
merge_request
:
15379
author
:
type
:
added
ee/spec/frontend/design_management/components/design_notes/design_reply_form_spec.js
View file @
2cc82cbf
...
...
@@ -96,8 +96,8 @@ describe('Design reply form component', () => {
expect
(
wrapper
.
emitted
(
'
input
'
)).
toBeTruthy
();
});
it
(
'
emits cancelForm event on
escape keydow
n on textarea
'
,
()
=>
{
findTextarea
().
trigger
(
'
key
down
.esc
'
);
it
(
'
emits cancelForm event on
pressing escape butto
n on textarea
'
,
()
=>
{
findTextarea
().
trigger
(
'
key
up
.esc
'
);
expect
(
wrapper
.
emitted
(
'
cancelForm
'
)).
toBeTruthy
();
});
...
...
ee/spec/frontend/design_management/pages/design/index_spec.js
View file @
2cc82cbf
...
...
@@ -5,9 +5,13 @@ import DesignReplyForm from 'ee/design_management/components/design_notes/design
import
createImageDiffNoteMutation
from
'
ee/design_management/graphql/mutations/createImageDiffNote.mutation.graphql
'
;
import
design
from
'
../../mock_data/design
'
;
jest
.
mock
(
'
mousetrap
'
,
()
=>
({
bind
:
jest
.
fn
(),
unbind
:
jest
.
fn
(),
}));
describe
(
'
Design management design index page
'
,
()
=>
{
let
wrapper
;
const
newComment
=
'
new comment
'
;
const
annotationCoordinates
=
{
x
:
10
,
...
...
ee/spec/frontend/design_management/router_spec.js
View file @
2cc82cbf
...
...
@@ -6,6 +6,11 @@ import DesignDetail from 'ee/design_management/pages/design/index.vue';
import
createRouter
from
'
ee/design_management/router
'
;
import
'
~/commons/bootstrap
'
;
jest
.
mock
(
'
mousetrap
'
,
()
=>
({
bind
:
jest
.
fn
(),
unbind
:
jest
.
fn
(),
}));
describe
(
'
Design management router
'
,
()
=>
{
let
vm
;
let
router
;
...
...
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