Skip to content

Commit 0756717

Browse files
committed
Merge branch 't/12387'
2 parents a5c6dc4 + d9b5d29 commit 0756717

File tree

6 files changed

+55
-4
lines changed

6 files changed

+55
-4
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Fixed Issues:
1414
* [#12750](http://dev.ckeditor.com/ticket/12750): Fixed: [Paste from Word](http://ckeditor.com/addon/pastefromword): strikethrough and underscore should have the same color as font.
1515
* [#10032](http://dev.ckeditor.com/ticket/10032): Fixed: [Paste from Word](http://ckeditor.com/addon/pastefromword) filter is executed for every paste after using the button.
1616
* [#12597](http://dev.ckeditor.com/ticket/12597): [Blink/Webkit] Fixed: Multi-byte Japanese chars entry not working properly after *Shift+Enter*.
17+
* [#12387](http://dev.ckeditor.com/ticket/12387): Fixed: An error is thrown if a skin does not have the [`chameleon`](http://docs.ckeditor.com/#!/api/CKEDITOR.skin-method-chameleon) property defined and [`config.uiColor`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-uiColor) was defined.
1718

1819
## CKEditor 4.4.6
1920

core/skin.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,24 @@
195195
var uiStyle = getStylesheet( CKEDITOR.document );
196196

197197
return ( this.setUiColor = function( color ) {
198-
var chameleon = CKEDITOR.skin.chameleon;
198+
this.uiColor = color;
199+
200+
var chameleon = CKEDITOR.skin.chameleon,
201+
editorStyleContent = '',
202+
panelStyleContent = '';
203+
204+
if ( typeof chameleon == 'function' ) {
205+
editorStyleContent = chameleon( this, 'editor' );
206+
panelStyleContent = chameleon( this, 'panel' );
207+
}
199208

200209
var replace = [ [ uiColorRegexp, color ] ];
201-
this.uiColor = color;
202210

203211
// Update general style.
204-
updateStylesheets( [ uiStyle ], chameleon( this, 'editor' ), replace );
212+
updateStylesheets( [ uiStyle ], editorStyleContent, replace );
205213

206214
// Update panel styles.
207-
updateStylesheets( uiColorMenus, chameleon( this, 'panel' ), replace );
215+
updateStylesheets( uiColorMenus, panelStyleContent, replace );
208216
} ).call( this, color );
209217
}
210218
} );

tests/core/skin/_assets/skins/skinnochameleon/editor.css

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CKEDITOR.skin = 'skinnochameleon';
2+
3+
// That's enough.
File renamed without changes.

tests/core/skin/skinnochameleon.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* bender-tags: editor,unit,skin */
2+
3+
( function() {
4+
'use strict';
5+
6+
var caughtError = null,
7+
originalErrorFunc = bender.error;
8+
9+
bender.error = function( e ) {
10+
caughtError = e;
11+
};
12+
13+
bender.test( {
14+
'async:init': function() {
15+
var tc = this;
16+
17+
bender.tools.setUpEditors( {
18+
editor: {
19+
startupData: '<p>foo</p>',
20+
config: {
21+
skin: 'skinnochameleon,%TEST_DIR%/_assets/skins/skinnochameleon/',
22+
uiColor: '#333888'
23+
}
24+
}
25+
}, function( editors ) {
26+
tc.editor = editors.editor;
27+
setTimeout( tc.callback, 0 );
28+
} );
29+
},
30+
31+
'test skin with no chameleon functionality and custom uiColor': function() {
32+
bender.error = originalErrorFunc;
33+
34+
assert.isNull( caughtError, 'An error is not thrown during editor initialisation' );
35+
assert.areSame( 'ready', this.editor.status, 'Editor is really ready' );
36+
assert.areSame( 'skinnochameleon', CKEDITOR.skin );
37+
}
38+
} );
39+
}() );

0 commit comments

Comments
 (0)