Skip to content

Commit

Permalink
Merge branch 't/14869'
Browse files Browse the repository at this point in the history
  • Loading branch information
Comandeer committed Jan 9, 2017
2 parents 305b2bb + fd8abe0 commit 35cb196
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/find/dialogs/find.js
Expand Up @@ -791,11 +791,15 @@
var range;
if ( finder.matchRange && finder.matchRange.isMatched() ) {
finder.matchRange.removeHighlight();
editor.focus();

range = finder.matchRange.toDomRange();
if ( range )
editor.getSelection().selectRanges( [ range ] );

// Focus must be restored to the editor after selecting range.
// Otherwise there are issues when selecting word from
// newly added paragraphs (#14869).
editor.focus();
}

// Clear current session before dialog close
Expand Down
4 changes: 4 additions & 0 deletions tests/plugins/find/manual/textnodesplit.html
@@ -0,0 +1,4 @@
<textarea id="editor1">New Paragraph added</textarea>
<script>
CKEDITOR.replace( 'editor1' );
</script>
20 changes: 20 additions & 0 deletions tests/plugins/find/manual/textnodesplit.md
@@ -0,0 +1,20 @@
@bender-tags: 4.6.2, tc, 14869
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea,divarea,find,clipboard,undo,toolbar

## Scenario

1. Add a new paragraph with at least two words beneath the one already present.
2. Open the `Find` dialog.
3. Type one of the newly added words from the editor into the _Find what_ input and click _Find_.
4. Close the dialog.

Make sure to go through this scenario with all the newly added words.

### Expected result:

After dialog is closed, the editor is focused and the searched-for text is selected.

### Unexpected:

After dialog is closed, editor is not focused or there are errors in the console.

0 comments on commit 35cb196

Please sign in to comment.