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 #62 from ckeditor/t/47
Browse files Browse the repository at this point in the history
T/47 Fixed: Selection collapsed in wrong position after new text node is created.
  • Loading branch information
Reinmar committed Nov 16, 2016
2 parents 55722db + 0360722 commit 4beadce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class MutationHandler {

this._insert( modelPos, insertedText );

this.editing.model.selection.collapse( modelPos.parent, 'end' );
this.editing.model.selection.collapse( modelPos.getShiftedBy( insertedText.length ) );
}

_insert( position, text ) {
Expand Down
5 changes: 3 additions & 2 deletions tests/manual/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import ClassicEditor from '/ckeditor5/editor-classic/classic.js';
import Enter from '/ckeditor5/enter/enter.js';
import Typing from '/ckeditor5/typing/typing.js';
import Paragraph from '/ckeditor5/paragraph/paragraph.js';
import Bold from '/ckeditor5/basic-styles/bold.js';
import Undo from '/ckeditor5/undo/undo.js';

ClassicEditor.create( document.querySelector( '#editor' ), {
features: [ Enter, Typing, Paragraph, Undo ],
toolbar: []
features: [ Enter, Typing, Paragraph, Undo, Bold ],
toolbar: [ 'bold' ]
} )
.then( editor => {
window.editor = editor;
Expand Down
7 changes: 7 additions & 0 deletions tests/manual/selection.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@
1. Focus somewhere in the middle of text.
2. Write "emd" and press <kbd>space</kbd>.
3. Safari autocorrect should change "emd" to "end" and selection should be placed after space character.

#### Empty inline attributes

1. Focus selection at "ins^tance".
2. Use "Bold" feature.
3. Type a letter.
4. Selection should be placed after typed letter, "Bold" button should be on, next typed letters should be bold.

0 comments on commit 4beadce

Please sign in to comment.