Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 't/12387'
  • Loading branch information
Reinmar committed Jan 21, 2015
2 parents a5c6dc4 + d9b5d29 commit 0756717
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -14,6 +14,7 @@ Fixed Issues:
* [#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.
* [#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.
* [#12597](http://dev.ckeditor.com/ticket/12597): [Blink/Webkit] Fixed: Multi-byte Japanese chars entry not working properly after *Shift+Enter*.
* [#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.

## CKEditor 4.4.6

Expand Down
16 changes: 12 additions & 4 deletions core/skin.js
Expand Up @@ -195,16 +195,24 @@
var uiStyle = getStylesheet( CKEDITOR.document );

return ( this.setUiColor = function( color ) {
var chameleon = CKEDITOR.skin.chameleon;
this.uiColor = color;

var chameleon = CKEDITOR.skin.chameleon,
editorStyleContent = '',
panelStyleContent = '';

if ( typeof chameleon == 'function' ) {
editorStyleContent = chameleon( this, 'editor' );
panelStyleContent = chameleon( this, 'panel' );
}

var replace = [ [ uiColorRegexp, color ] ];
this.uiColor = color;

// Update general style.
updateStylesheets( [ uiStyle ], chameleon( this, 'editor' ), replace );
updateStylesheets( [ uiStyle ], editorStyleContent, replace );

// Update panel styles.
updateStylesheets( uiColorMenus, chameleon( this, 'panel' ), replace );
updateStylesheets( uiColorMenus, panelStyleContent, replace );
} ).call( this, color );
}
} );
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions tests/core/skin/_assets/skins/skinnochameleon/skin.js
@@ -0,0 +1,3 @@
CKEDITOR.skin = 'skinnochameleon';

// That's enough.
File renamed without changes.
39 changes: 39 additions & 0 deletions tests/core/skin/skinnochameleon.js
@@ -0,0 +1,39 @@
/* bender-tags: editor,unit,skin */

( function() {
'use strict';

var caughtError = null,
originalErrorFunc = bender.error;

bender.error = function( e ) {
caughtError = e;
};

bender.test( {
'async:init': function() {
var tc = this;

bender.tools.setUpEditors( {
editor: {
startupData: '<p>foo</p>',
config: {
skin: 'skinnochameleon,%TEST_DIR%/_assets/skins/skinnochameleon/',
uiColor: '#333888'
}
}
}, function( editors ) {
tc.editor = editors.editor;
setTimeout( tc.callback, 0 );
} );
},

'test skin with no chameleon functionality and custom uiColor': function() {
bender.error = originalErrorFunc;

assert.isNull( caughtError, 'An error is not thrown during editor initialisation' );
assert.areSame( 'ready', this.editor.status, 'Editor is really ready' );
assert.areSame( 'skinnochameleon', CKEDITOR.skin );
}
} );
}() );

0 comments on commit 0756717

Please sign in to comment.