Skip to content

Commit ec78f62

Browse files
committed
Merge branch 't/12157'
2 parents 3f7d8da + 87d0a2c commit ec78f62

File tree

5 files changed

+34
-4
lines changed

5 files changed

+34
-4
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CKEditor 4 Changelog
55

66
Fixed Issues:
77

8+
* [#12157](http://dev.ckeditor.com/ticket/12157): Fixed: Lost text formatting when pressing `tab` when [tabSpaces](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-tabSpaces) config option was greater than zero.
89
* [#12777](http://dev.ckeditor.com/ticket/12777): Fixed: The `table-layout` CSS property should be reset by skins. Thanks to [vita10gy](https://github.com/vita10gy)!
910
* [#12747](http://dev.ckeditor.com/ticket/12747): [IE8-10] Fixed: Opening a drop-down for a specific selection when editor is maximized results in incorrect drop-down panel position.
1011
* [#12735](http://dev.ckeditor.com/ticket/12735): Fixed: [`Config.fillEmptyBlocks`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-fillEmptyBlocks) should only apply when outputting data.

plugins/tab/plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@
9393

9494
if ( tabText ) {
9595
editor.on( 'key', function( ev ) {
96-
// TAB
96+
// TAB.
9797
if ( ev.data.keyCode == 9 ) {
98-
editor.insertHtml( tabText );
98+
editor.insertText( tabText );
9999
ev.cancel();
100100
}
101101
} );
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<textarea id="editor1">
2+
<p><strong>Foobar</strong></p>
3+
</textarea>
4+
5+
<script>
6+
CKEDITOR.replace( 'editor1', {
7+
tabSpaces: 4
8+
} );
9+
</script>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@bender-tags: 4.4.7, tc
2+
@bender-ui: collapsed
3+
@bender-ckeditor-plugins: wysiwygarea, tab, basicstyles, toolbar
4+
5+
1. Place caret after "Foo".
6+
2. Press the Tab key to insert spaces.
7+
* Expected: the Bold button should be "on".
8+
3. Type a word.
9+
* Expected: the word should be bolded.

tests/plugins/tab/tab.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,30 @@
55

66
bender.editor = {
77
config: {
8-
allowedContent: 'p',
8+
allowedContent: 'p em',
99
tabSpaces: 3,
1010
plugins: 'tab'
1111
}
1212
};
1313

1414
bender.test( {
1515
'test tabSpaces setting': function() {
16-
this.editorBot.setHtmlWithSelection( '<p>foo^bar</p>' );
16+
bender.tools.selection.setWithHtml( this.editor, '<p>foo{}bar</p>' );
1717

1818
this.editor.editable().fire( 'keydown', new CKEDITOR.dom.event( { keyCode: 9 } ) );
1919

2020
assert.areSame( '<p>foo&nbsp;&nbsp;&nbsp;bar</p>', this.editorBot.getData( true ), '3 spaces were inserted' );
21+
},
22+
23+
// #12157
24+
'test tab preserves inline styles': function() {
25+
bender.tools.selection.setWithHtml( this.editor, '<p><em>foo{}</em>bar</p>' );
26+
27+
this.editor.editable().fire( 'keydown', new CKEDITOR.dom.event( { keyCode: 9 } ) );
28+
this.editor.insertText( 'x' );
29+
30+
assert.areSame( '<p><em>foo&nbsp;&nbsp;&nbsp;x</em>bar</p>', this.editorBot.getData( true ),
31+
'spaces and text were inserted into the inline element' );
2132
}
2233
} );
2334

0 commit comments

Comments
 (0)