mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-26 19:56:49 +00:00
Basic support for backspace button
This commit is contained in:
parent
bc26561ada
commit
b2db4c43eb
Notes:
Gabriel Wicke
2012-02-27 16:40:01 +00:00
|
@ -22,13 +22,21 @@ es.SurfaceView = function( $container, model ) {
|
|||
};
|
||||
|
||||
es.SurfaceView.prototype.onKeyDown = function( e ) {
|
||||
if ( e.which == 13 ) {
|
||||
if ( e.which === 13 ) {
|
||||
e.preventDefault();
|
||||
var range = this.getSelection();
|
||||
if ( range.start === range.end ) {
|
||||
var tx = this.model.getDocument().prepareInsertion( range.start, [ { 'type': '/paragraph' }, { 'type': 'paragraph' } ]);
|
||||
this.model.transact( tx );
|
||||
}
|
||||
} else if ( e.which === 8 ) {
|
||||
console.log("A");
|
||||
e.preventDefault();
|
||||
var range = this.getSelection();
|
||||
if ( range.start != range.end ) {
|
||||
var tx = this.model.getDocument().prepareRemoval( range );
|
||||
this.model.transact( tx );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue