From 01be64654d4b8dd2339c95cc8db1a89ef368b15a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Krzto=C5=84?= Date: Fri, 10 Mar 2017 10:01:22 +0100 Subject: [PATCH 1/3] Added composition start key to safe keys. --- src/input.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/input.js b/src/input.js index c1977c4..68c9db1 100644 --- a/src/input.js +++ b/src/input.js @@ -259,6 +259,7 @@ const safeKeycodes = [ 34, // PageDown 35, // Home 36, // End + 229 // Composition start key ]; // Function keys. From 817d3c1ec376f3892b8a766f351248c00f6e7b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Krzto=C5=84?= Date: Fri, 10 Mar 2017 10:02:14 +0100 Subject: [PATCH 2/3] Tests: #82 manual and unit test. --- tests/input.js | 12 ++++++++++++ tests/manual/82/1.html | 3 +++ tests/manual/82/1.js | 29 +++++++++++++++++++++++++++++ tests/manual/82/1.md | 10 ++++++++++ 4 files changed, 54 insertions(+) create mode 100644 tests/manual/82/1.html create mode 100644 tests/manual/82/1.js create mode 100644 tests/manual/82/1.md diff --git a/tests/input.js b/tests/input.js index 6b732a0..5666aee 100644 --- a/tests/input.js +++ b/tests/input.js @@ -429,6 +429,18 @@ describe( 'Input feature', () => { expect( getModelData( model ) ).to.equal( 'fo[ob]ar' ); } ); + // #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( 'fo[ob]ar' ); + } ); + it( 'should do nothing if selection is collapsed', () => { view.fire( 'keydown', { ctrlKey: true, keyCode: getCode( 'c' ) } ); diff --git a/tests/manual/82/1.html b/tests/manual/82/1.html new file mode 100644 index 0000000..c1f5bc8 --- /dev/null +++ b/tests/manual/82/1.html @@ -0,0 +1,3 @@ +
+

This is an editor instance.

+
diff --git a/tests/manual/82/1.js b/tests/manual/82/1.js new file mode 100644 index 0000000..c7b99b3 --- /dev/null +++ b/tests/manual/82/1.js @@ -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'; +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 ); + } ); diff --git a/tests/manual/82/1.md b/tests/manual/82/1.md new file mode 100644 index 0000000..f762f50 --- /dev/null +++ b/tests/manual/82/1.md @@ -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. From 74952c3aa7fe5fb6a864baf2acb373b84e9bc2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Krzto=C5=84?= Date: Fri, 10 Mar 2017 10:18:38 +0100 Subject: [PATCH 3/3] Tests: fix indentation. --- tests/manual/82/1.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/manual/82/1.js b/tests/manual/82/1.js index c7b99b3..7a6315f 100644 --- a/tests/manual/82/1.js +++ b/tests/manual/82/1.js @@ -21,9 +21,9 @@ 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 ); - } ); +.then( editor => { + window.editor = editor; +} ) +.catch( err => { + console.error( err.stack ); +} );