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

T/82 Spanish accent character is removed while typed in non-collapsed selection. #84

Merged
merged 3 commits into from
Mar 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ const safeKeycodes = [
34, // PageDown
35, // Home
36, // End
229 // Composition start key
];

// Function keys.
Expand Down
12 changes: 12 additions & 0 deletions tests/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,18 @@ describe( 'Input feature', () => {
expect( getModelData( model ) ).to.equal( '<paragraph>fo[ob]ar</paragraph>' );
} );

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

view.fire( 'keydown', { keyCode: 229 } );

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
3 changes: 3 additions & 0 deletions tests/manual/82/1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div id="editor">
<p>This is an editor instance.</p>
</div>
29 changes: 29 additions & 0 deletions tests/manual/82/1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/

/* globals console, window, document */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classic';
import Enter from '@ckeditor/ckeditor5-enter/src/enter';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the future – you can use presets/essentials to provide these basic plugins.

import Typing from '../../../src/typing';
import Heading from '@ckeditor/ckeditor5-heading/src/heading';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Undo from '@ckeditor/ckeditor5-undo/src/undo';
import { getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';

window.setInterval( function() {
console.log( getData( window.editor.document ) );
}, 3000 );

ClassicEditor.create( document.querySelector( '#editor' ), {
plugins: [ Enter, Typing, Paragraph, Undo, Heading ],
toolbar: [ 'headings', 'undo', 'redo' ]
} )
.then( editor => {
window.editor = editor;
} )
.catch( err => {
console.error( err.stack );
} );
10 changes: 10 additions & 0 deletions tests/manual/82/1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Input - non-collapsed IME

_Check composition on non-collapsed selection_:

* Hiragana,
* Spanish-ISO: accent (it's under `'`) + "a",
* MacOS: long "a" press (accent balloon).

**Expected**: Composition should be started correctly, character starting the composition should be visible. The selected
text should be replaced by composition start character.