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
88889d16
Commit
88889d16
authored
Jul 04, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cancel creating or editing note by hitting Escape
parent
021b6aef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
app/assets/javascripts/notes.js.coffee
app/assets/javascripts/notes.js.coffee
+20
-5
No files found.
app/assets/javascripts/notes.js.coffee
View file @
88889d16
...
...
@@ -100,13 +100,25 @@ class @Notes
$
(
'.note .js-task-list-container'
).
taskList
(
'disable'
)
$
(
document
).
off
'tasklist:changed'
,
'.note .js-task-list-container'
keydownNoteText
:
(
e
)
->
$this
=
$
(
this
)
if
$this
.
val
()
is
''
and
e
.
which
is
38
and
not
isMetaKey
e
keydownNoteText
:
(
e
)
=>
return
if
isMetaKey
e
$textarea
=
$
(
e
.
target
)
if
$textarea
.
val
()
is
''
and
e
.
which
is
38
myLastNote
=
$
(
"li.note[data-author-id='
#{
gon
.
current_user_id
}
'][data-editable]:last"
)
if
myLastNote
.
length
myLastNoteEditBtn
=
myLastNote
.
find
(
'.js-note-edit'
)
myLastNoteEditBtn
.
trigger
(
'click'
,
[
true
,
myLastNote
])
if
e
.
which
is
27
discussionNoteForm
=
$textarea
.
closest
(
".js-discussion-note-form"
)
if
discussionNoteForm
.
length
@
removeDiscussionNoteForm
(
discussionNoteForm
)
return
editNote
=
$textarea
.
closest
(
".note"
)
if
editNote
.
length
@
removeNoteEditForm
(
editNote
)
isMetaKey
=
(
e
)
->
(
e
.
metaKey
or
e
.
ctrlKey
or
e
.
altKey
or
e
.
shiftKey
)
...
...
@@ -401,9 +413,12 @@ class @Notes
Hides edit form and restores the original note text to the editor textarea.
###
cancelEdit
:
(
e
)
-
>
cancelEdit
:
(
e
)
=
>
e
.
preventDefault
()
note
=
$
(
this
).
closest
(
".note"
)
note
=
$
(
e
.
target
).
closest
(
".note"
)
@
removeNoteEditForm
(
note
)
removeNoteEditForm
:
(
note
)
->
form
=
note
.
find
(
".current-note-edit-form"
)
note
.
removeClass
"is-editting"
form
.
removeClass
(
"current-note-edit-form"
)
...
...
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