X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fstylescombo%2Fplugin.js;h=d2f8eb3efaa7c396a9c2b291b2898c0add803323;hb=48b1db88210b4160dce439c6e3e32e14af8c106b;hp=8ed7f9b429dabef53f6d4ce025f83a5a57b8a590;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/plugins/stylescombo/plugin.js b/_source/plugins/stylescombo/plugin.js index 8ed7f9b..d2f8eb3 100644 --- a/_source/plugins/stylescombo/plugin.js +++ b/_source/plugins/stylescombo/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -26,7 +26,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license styleName; // Put all styles into an Array. - for ( var i = 0 ; i < stylesDefinitions.length ; i++ ) + for ( var i = 0, count = stylesDefinitions.length ; i < count ; i++ ) { var styleDefinition = stylesDefinitions[ i ]; @@ -34,6 +34,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license style = styles[ styleName ] = new CKEDITOR.style( styleDefinition ); style._name = styleName; + style._.enterMode = config.enterMode; stylesList.push( style ); } @@ -70,7 +71,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Loop over the Array, adding all items to the // combo. var lastType; - for ( var i = 0 ; i < stylesList.length ; i++ ) + for ( var i = 0, count = stylesList.length ; i < count ; i++ ) { style = stylesList[ i ]; styleName = style._name; @@ -105,10 +106,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var elementPath = new CKEDITOR.dom.elementPath( selection.getStartElement() ); - if ( style.type == CKEDITOR.STYLE_INLINE && style.checkActive( elementPath ) ) - style.remove( editor.document ); - else - style.apply( editor.document ); + style[ style.checkActive( elementPath ) ? 'remove' : 'apply' ]( editor.document ); editor.fire( 'saveSnapshot' ); }, @@ -123,7 +121,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license elements = elementPath.elements; // For each element into the elements path. - for ( var i = 0, element ; i < elements.length ; i++ ) + for ( var i = 0, count = elements.length, element ; i < count ; i++ ) { element = elements[i]; @@ -151,9 +149,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( CKEDITOR.env.ie || CKEDITOR.env.webkit ) editor.focus(); - var selection = editor.getSelection(); - - var element = selection.getSelectedElement(), + var selection = editor.getSelection(), + element = selection.getSelectedElement(), elementPath = new CKEDITOR.dom.elementPath( element || selection.getStartElement() ); var counter = [ 0, 0, 0, 0 ];