Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #70 from ckeditor/t/69
Browse files Browse the repository at this point in the history
Fix: Tab key should not delete selected text. Closes: #69.
  • Loading branch information
Reinmar committed Feb 6, 2017
2 parents 3be14d8 + b9e8e8c commit 8447f51
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ const safeKeycodes = [
getCode( 'arrowRight' ),
getCode( 'arrowDown' ),
getCode( 'arrowLeft' ),
9, // Tab
16, // Shift
17, // Ctrl
18, // Alt
Expand Down
12 changes: 12 additions & 0 deletions tests/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,18 @@ describe( 'Input feature', () => {
expect( getModelData( model ) ).to.equal( '<paragraph>fo[ob]ar</paragraph>' );
} );

// #69
it( 'should do nothing on tab key', () => {
model.enqueueChanges( () => {
model.selection.setRanges( [
ModelRange.createFromParentsAndOffsets( modelRoot.getChild( 0 ), 2, modelRoot.getChild( 0 ), 4 ) ] );
} );

view.fire( 'keydown', { keyCode: 9 } ); // Tab

expect( getModelData( model ) ).to.equal( '<paragraph>fo[ob]ar</paragraph>' );
} );

it( 'should do nothing if selection is collapsed', () => {
view.fire( 'keydown', { ctrlKey: true, keyCode: getCode( 'c' ) } );

Expand Down

0 comments on commit 8447f51

Please sign in to comment.