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
Boxiang Sun
gitlab-ce
Commits
4ba2632c
Commit
4ba2632c
authored
May 26, 2016
by
Jacob Schatz
Committed by
Phil Hughes
Jun 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add undo history once they click the enter or backspace key
parent
ad1d55eb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
app/assets/javascripts/lib/text_utility.js.coffee
app/assets/javascripts/lib/text_utility.js.coffee
+12
-1
No files found.
app/assets/javascripts/lib/text_utility.js.coffee
View file @
4ba2632c
...
@@ -102,7 +102,10 @@
...
@@ -102,7 +102,10 @@
$this
.
data
(
'md-tag'
)
$this
.
data
(
'md-tag'
)
)
)
gl
.
text
.
_previousState
=
null
$
(
window
).
on
'keydown'
,
(
e
)
=>
$
(
window
).
on
'keydown'
,
(
e
)
=>
$thisTextarea
=
$
(
'textarea:focus'
)
if
e
.
ctrlKey
or
e
.
metaKey
if
e
.
ctrlKey
or
e
.
metaKey
if
String
.
fromCharCode
(
e
.
which
).
toLowerCase
()
is
'z'
and
!
e
.
shiftKey
if
String
.
fromCharCode
(
e
.
which
).
toLowerCase
()
is
'z'
and
!
e
.
shiftKey
e
.
preventDefault
()
e
.
preventDefault
()
...
@@ -110,6 +113,14 @@
...
@@ -110,6 +113,14 @@
else
if
((
String
.
fromCharCode
(
e
.
which
).
toLowerCase
()
is
'z'
and
e
.
shiftKey
)
or
(
String
.
fromCharCode
(
e
.
which
).
toLowerCase
()
is
'y'
))
else
if
((
String
.
fromCharCode
(
e
.
which
).
toLowerCase
()
is
'z'
and
e
.
shiftKey
)
or
(
String
.
fromCharCode
(
e
.
which
).
toLowerCase
()
is
'y'
))
e
.
preventDefault
()
e
.
preventDefault
()
self
.
undoManager
.
redo
()
self
.
undoManager
.
redo
()
else
if
e
.
which
is
13
or
e
.
which
is
8
# enter key or backspace key has been pressed
if
gl
.
text
.
_previousState
?
gl
.
text
.
undoManager
.
addUndo
(
gl
.
text
.
_previousState
,
$thisTextarea
.
val
()
)
gl
.
text
.
_previousState
=
$thisTextarea
.
val
()
gl
.
text
.
removeListeners
=
()
->
gl
.
text
.
removeListeners
=
()
->
$
(
'js-md.btn-bold'
).
off
()
$
(
'js-md.btn-bold'
).
off
()
...
...
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