Skip to content

Commit

Permalink
Merge branch 't/13771'
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewand committed Oct 22, 2015
2 parents aaf4c8d + 580ac22 commit 8eb2434
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -9,6 +9,7 @@ Fixed Issues:
* [#13803](https://dev.ckeditor.com/ticket/13803): Fixed: Allow the editor to be destroyed before being fully initialized. Thanks to [Cyril Fluck](https://github.com/cyril-sf)!
* [#13361](http://dev.ckeditor.com/ticket/13361): Fixed: Images fail when site path includes parentheses because background-image path needs single-quotes around URL value.
* [#13798](http://dev.ckeditor.com/ticket/13798): Fixed: Changing paragraph format causes cursor to move on Firefox 41.
* [#13771](http://dev.ckeditor.com/ticket/13771): Fixed: Now `contents.css` style will be used even if [IFrame Editing Area](http://ckeditor.com/addon/wysiwygarea) plugin is missing.

Other Changes:

Expand Down
19 changes: 18 additions & 1 deletion core/config.js
@@ -1,4 +1,4 @@
/**
/**
* @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
Expand Down Expand Up @@ -249,6 +249,23 @@ CKEDITOR.config = {
*/
height: 200,

/**
* The CSS file(s) to be used to apply style to editor content. It should
* reflect the CSS used in the target pages where the content is to be
* displayed.
*
* **Note:** This configuration value is ignored by [inline editor](#!/guide/dev_inline)
* as it uses the styles that come directly from the page that CKEditor is
* rendered on. It is also ignored in the {@link #fullPage full page mode} in
* which developer has a full control over the HTML.
*
* config.contentsCss = '/css/mysitestyles.css';
* config.contentsCss = ['/css/mysitestyles.css', '/css/anotherfile.css'];
*
* @cfg {String/Array} [contentsCss=CKEDITOR.getUrl( 'contents.css' )]
*/
contentsCss: CKEDITOR.getUrl( 'contents.css' ),

/**
* Comma-separated list of plugins to be used in an editor instance. Note that
* the actual plugins that are to be loaded could still be affected by two other settings:
Expand Down
18 changes: 0 additions & 18 deletions plugins/wysiwygarea/plugin.js
Expand Up @@ -653,24 +653,6 @@ CKEDITOR.config.disableNativeTableHandles = true;
*/
CKEDITOR.config.disableNativeSpellChecker = true;

/**
* The CSS file(s) to be used to apply style to editor content. It should
* reflect the CSS used in the target pages where the content is to be
* displayed.
*
* **Note:** This configuration value is ignored by [inline editor](#!/guide/dev_inline)
* as it uses the styles that come directly from the page that CKEditor is
* rendered on. It is also ignored in the {@link #fullPage full page mode} in
* which developer has a full control over the HTML.
*
* config.contentsCss = '/css/mysitestyles.css';
* config.contentsCss = ['/css/mysitestyles.css', '/css/anotherfile.css'];
*
* @cfg {String/Array} [contentsCss=CKEDITOR.getUrl( 'contents.css' )]
* @member CKEDITOR.config
*/
CKEDITOR.config.contentsCss = CKEDITOR.getUrl( 'contents.css' );

/**
* Language code of the writing language which is used to author the editor
* content. This option accepts one single entry value in the format defined in the
Expand Down
57 changes: 57 additions & 0 deletions tests/tickets/13771/1.js
@@ -0,0 +1,57 @@
/* bender-tags: 13771, config, font, format, stylescombo */
/* bender-ckeditor-plugins: font, format, stylescombo, toolbar */

( function() {
'use strict';

bender.editors = {
classic: {
config: {
toolbar: [ [ 'Font', 'FontSize', 'Format', 'Styles' ] ]
}
},
inline: {
creator: 'inline',
config: {
toolbar: [ [ 'Font', 'FontSize', 'Format', 'Styles' ] ]
}
}
};

var tests = {
'test if font combo loads proper stylesheet': function( editor, bot ) {
bot.combo( 'Font', function( combo ) {
assert.isTrue( searchForStylesheet( combo ), 'stylesheet is present in combo\'s iframe' );
} );
},

'test if font size combo loads proper stylesheet': function( editor, bot ) {
bot.combo( 'FontSize', function( combo ) {
assert.isTrue( searchForStylesheet( combo ), 'stylesheet is present in combo\'s iframe' );
} );
},

'test if format combo loads proper stylesheet': function( editor, bot ) {
bot.combo( 'Format', function( combo ) {
assert.isTrue( searchForStylesheet( combo ), 'stylesheet is present in combo\'s iframe' );
} );
},

'test if styles combo loads proper stylesheet': function( editor, bot ) {
bot.combo( 'Styles', function( combo ) {
assert.isTrue( searchForStylesheet( combo ), 'stylesheet is present in combo\'s iframe' );
} );
}
};

tests = bender.tools.createTestsForEditors( CKEDITOR.tools.objectKeys( bender.editors ), tests );

bender.test( tests );

function searchForStylesheet( combo ) {
var frameDoc = combo._.panel.element.getFirst().getFrameDocument();

// Look for any stylesheet link elems that end with desired CSS file.
return Boolean( frameDoc.findOne( 'link[rel="stylesheet"][href$="contents.css"]' ) );
}
} )();
23 changes: 23 additions & 0 deletions tests/tickets/13771/2.html
@@ -0,0 +1,23 @@
<body>
<div id="classic">
<p>Font Styles</p>
</div>

<div id="inline" contenteditable="true">
<p>Font Styles</p>
</div>

<script>
( function() {
'use strict';

var editorConfig = {
toolbar: [ [ 'Font', 'FontSize', 'Format', 'Styles' ] ]
};

CKEDITOR.replace( 'classic', editorConfig );

CKEDITOR.inline( 'inline', editorConfig );
} )();
</script>
</body>
27 changes: 27 additions & 0 deletions tests/tickets/13771/2.md
@@ -0,0 +1,27 @@
@bender-tags: tc, 4.5.5, 13771, config, font, format, stylescombo
@bender-ui: collapsed
@bender-ckeditor-plugins: font, format, stylescombo, toolbar, floatingspace, wysiwygarea

----
Look at the editor's toolbar. Then:

1. Open "Font" combo.
* The font used in combo's header should be the same as the one used in editable area.
2. Open "Size" combo.
* The font used in combo's header should be the same as the one used in editable area.
3. Open "Normal" combo.
* The font used in combo's header should be the same as the one used in editable area.
4. Open "Styles" combo.
* The font used in combo's header should be the same as the one used in editable area.

----
Click the second "Font styles" text to activate inline editor. Then:

1. Open "Font" combo.
* The font used in combo's header should be different than the one used in editable area.
2. Open "Size" combo.
* The font used in combo's header should be different than the one used in editable area.
3. Open "Normal" combo.
* The font used in combo's header should be different than the one used in editable area.
4. Open "Styles" combo.
* The font used in combo's header should be different than the one used in editable area.

0 comments on commit 8eb2434

Please sign in to comment.