Skip to content

Commit 12de140

Browse files
committed
Merge branch 't/10291'
2 parents d84ac37 + 4d9e134 commit 12de140

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CKEditor 4 Changelog
1212
* [#10315](http://dev.ckeditor.com/ticket/10315): [Webkit] Undo manager should not record snapshots after filling char has been added/removed.
1313
* [#10320](http://dev.ckeditor.com/ticket/10320): Justify plugin should add elements to the ACF based on current enter mode.
1414
* [#10260](http://dev.ckeditor.com/ticket/10260): Fixed: Advanced Content Filter blocks tabSpaces. Unified `data-cke-*` attributes filtering.
15+
* [#10291](http://dev.ckeditor.com/ticket/10291): [Webkit] Space after filling char should be secured.
1516

1617
## CKEditor 4.1
1718

core/selection.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
// We can't simply remove the filling node because the user
150150
// will actually enlarge it when typing, so we just remove the
151151
// invisible char from it.
152-
fillingChar.setText( fillingChar.getText().replace( /\u200B/g, '' ) );
152+
fillingChar.setText( replaceFillingChar( fillingChar.getText() ) );
153153

154154
// Restore the bookmark.
155155
if ( bm ) {
@@ -162,6 +162,13 @@
162162
}
163163
}
164164

165+
function replaceFillingChar( html ) {
166+
return html.replace( /\u200B( )?/g, function( match ) {
167+
// #10291 if filling char is followed by a space replace it with nbsp.
168+
return match[ 1 ] ? '\xa0' : '';
169+
} );
170+
}
171+
165172
function isReversedSelection( sel ) {
166173
if ( !sel.isCollapsed ) {
167174
var range = sel.getRangeAt( 0 );
@@ -489,7 +496,7 @@
489496
resetSelection = 1;
490497

491498
fillingCharBefore = fillingChar.getText();
492-
fillingChar.setText( fillingCharBefore.replace( /\u200B/g, '' ) );
499+
fillingChar.setText( replaceFillingChar( fillingCharBefore ) );
493500
}
494501
}
495502

0 commit comments

Comments
 (0)