Index: trunk/extensions/VisualEditor/contentEditable/views/es.SurfaceView.js |
— | — | @@ -22,13 +22,21 @@ |
23 | 23 | };
|
24 | 24 |
|
25 | 25 | es.SurfaceView.prototype.onKeyDown = function( e ) {
|
26 | | - if ( e.which == 13 ) {
|
| 26 | + if ( e.which === 13 ) {
|
27 | 27 | e.preventDefault();
|
28 | 28 | var range = this.getSelection();
|
29 | 29 | if ( range.start === range.end ) {
|
30 | 30 | var tx = this.model.getDocument().prepareInsertion( range.start, [ { 'type': '/paragraph' }, { 'type': 'paragraph' } ]);
|
31 | 31 | this.model.transact( tx );
|
32 | 32 | }
|
| 33 | + } else if ( e.which === 8 ) {
|
| 34 | + console.log("A");
|
| 35 | + e.preventDefault();
|
| 36 | + var range = this.getSelection();
|
| 37 | + if ( range.start != range.end ) {
|
| 38 | + var tx = this.model.getDocument().prepareRemoval( range );
|
| 39 | + this.model.transact( tx );
|
| 40 | + }
|
33 | 41 | }
|
34 | 42 | };
|
35 | 43 |
|