Skip to content

Commit

Permalink
Merge branch 't/10291'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Apr 16, 2013
2 parents d84ac37 + 4d9e134 commit 12de140
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -12,6 +12,7 @@ CKEditor 4 Changelog
* [#10315](http://dev.ckeditor.com/ticket/10315): [Webkit] Undo manager should not record snapshots after filling char has been added/removed.
* [#10320](http://dev.ckeditor.com/ticket/10320): Justify plugin should add elements to the ACF based on current enter mode.
* [#10260](http://dev.ckeditor.com/ticket/10260): Fixed: Advanced Content Filter blocks tabSpaces. Unified `data-cke-*` attributes filtering.
* [#10291](http://dev.ckeditor.com/ticket/10291): [Webkit] Space after filling char should be secured.

## CKEditor 4.1

Expand Down
11 changes: 9 additions & 2 deletions core/selection.js
Expand Up @@ -149,7 +149,7 @@
// We can't simply remove the filling node because the user
// will actually enlarge it when typing, so we just remove the
// invisible char from it.
fillingChar.setText( fillingChar.getText().replace( /\u200B/g, '' ) );
fillingChar.setText( replaceFillingChar( fillingChar.getText() ) );

// Restore the bookmark.
if ( bm ) {
Expand All @@ -162,6 +162,13 @@
}
}

function replaceFillingChar( html ) {
return html.replace( /\u200B( )?/g, function( match ) {
// #10291 if filling char is followed by a space replace it with nbsp.
return match[ 1 ] ? '\xa0' : '';
} );
}

function isReversedSelection( sel ) {
if ( !sel.isCollapsed ) {
var range = sel.getRangeAt( 0 );
Expand Down Expand Up @@ -489,7 +496,7 @@
resetSelection = 1;

fillingCharBefore = fillingChar.getText();
fillingChar.setText( fillingCharBefore.replace( /\u200B/g, '' ) );
fillingChar.setText( replaceFillingChar( fillingCharBefore ) );
}
}

Expand Down

0 comments on commit 12de140

Please sign in to comment.