fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Preventing browser from removing node when last character gets deleted via backspace
[fnpeditor.git]
/
modules
/
documentCanvas
/
documentCanvas.js
diff --git
a/modules/documentCanvas/documentCanvas.js
b/modules/documentCanvas/documentCanvas.js
index
bb8ad4a
..
4e61b88
100644
(file)
--- a/
modules/documentCanvas/documentCanvas.js
+++ b/
modules/documentCanvas/documentCanvas.js
@@
-51,6
+51,15
@@
return function(sandbox) {
e.preventDefault();
\r
view.insertNewNode(null, null);
\r
}
\r
e.preventDefault();
\r
view.insertNewNode(null, null);
\r
}
\r
+ if(e.which === 8) {
\r
+ var anchor = window.getSelection().anchorNode;
\r
+ var len = anchor.length;
\r
+ console.log(len);
\r
+ if(len === 1) {
\r
+ e.preventDefault();
\r
+ $(anchor).parent().text('');
\r
+ }
\r
+ }
\r
});
\r
\r
this.node.onShow = function() {
\r
});
\r
\r
this.node.onShow = function() {
\r