Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
peach-html5-editor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ae38e0d
)
implement backspace key
author
Jason Woofenden
<jason@jasonwoof.com>
Wed, 24 Feb 2016 19:04:05 +0000
(14:04 -0500)
committer
Jason Woofenden
<jason@jasonwoof.com>
Wed, 24 Feb 2016 19:04:05 +0000
(14:04 -0500)
editor.coffee
patch
|
blob
|
history
diff --git
a/editor.coffee
b/editor.coffee
index
df8ad8a
..
2835af8
100644
(file)
--- a/
editor.coffee
+++ b/
editor.coffee
@@
-387,6
+387,11
@@
class PeachHTML5Editor
when KEY_END
return false
when KEY_BACKSPACE
+ return false unless @cursor?
+ return false unless @cursor[1] > 0
+ @cursor[0].text = @cursor[0].text.substr(0, @cursor[1] - 1) + @cursor[0].text.substr(@cursor[1])
+ @cursor[0].el.nodeValue = @cursor[0].text
+ @move_cursor [@cursor[0], @cursor[1] - 1]
return false
when KEY_DELETE
return false