Importation du code de ckeditor 4.3.4 en conservant les développements Plinn et en...
[ckeditor.git] / skins / ckeditor / _source / plugins / stylescombo / plugin.js
diff --git a/skins/ckeditor/_source/plugins/stylescombo/plugin.js b/skins/ckeditor/_source/plugins/stylescombo/plugin.js
deleted file mode 100644 (file)
index 086f109..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
-*/\r
-\r
-(function()\r
-{\r
-       CKEDITOR.plugins.add( 'stylescombo',\r
-       {\r
-               requires : [ 'richcombo', 'styles' ],\r
-\r
-               init : function( editor )\r
-               {\r
-                       var config = editor.config,\r
-                               lang = editor.lang.stylesCombo,\r
-                               styles = {},\r
-                               stylesList = [],\r
-                               combo;\r
-\r
-                       function loadStylesSet( callback )\r
-                       {\r
-                               editor.getStylesSet( function( stylesDefinitions )\r
-                               {\r
-                                       if ( !stylesList.length )\r
-                                       {\r
-                                               var style,\r
-                                                       styleName;\r
-\r
-                                               // Put all styles into an Array.\r
-                                               for ( var i = 0, count = stylesDefinitions.length ; i < count ; i++ )\r
-                                               {\r
-                                                       var styleDefinition = stylesDefinitions[ i ];\r
-\r
-                                                       styleName = styleDefinition.name;\r
-\r
-                                                       style = styles[ styleName ] = new CKEDITOR.style( styleDefinition );\r
-                                                       style._name = styleName;\r
-                                                       style._.enterMode = config.enterMode;\r
-\r
-                                                       stylesList.push( style );\r
-                                               }\r
-\r
-                                               // Sorts the Array, so the styles get grouped by type.\r
-                                               stylesList.sort( sortStyles );\r
-                                       }\r
-\r
-                                       callback && callback();\r
-                               });\r
-                       }\r
-\r
-                       editor.ui.addRichCombo( 'Styles',\r
-                               {\r
-                                       label : lang.label,\r
-                                       title : lang.panelTitle,\r
-                                       className : 'cke_styles',\r
-\r
-                                       panel :\r
-                                       {\r
-                                               css : editor.skin.editor.css.concat( config.contentsCss ),\r
-                                               multiSelect : true,\r
-                                               attributes : { 'aria-label' : lang.panelTitle }\r
-                                       },\r
-\r
-                                       init : function()\r
-                                       {\r
-                                               combo = this;\r
-\r
-                                               loadStylesSet( function()\r
-                                                       {\r
-                                                               var style,\r
-                                                                       styleName,\r
-                                                                       lastType,\r
-                                                                       type,\r
-                                                                       i,\r
-                                                                       count;\r
-\r
-                                                               // Loop over the Array, adding all items to the\r
-                                                               // combo.\r
-                                                               for ( i = 0, count = stylesList.length ; i < count ; i++ )\r
-                                                               {\r
-                                                                       style = stylesList[ i ];\r
-                                                                       styleName = style._name;\r
-                                                                       type = style.type;\r
-\r
-                                                                       if ( type != lastType )\r
-                                                                       {\r
-                                                                               combo.startGroup( lang[ 'panelTitle' + String( type ) ] );\r
-                                                                               lastType = type;\r
-                                                                       }\r
-\r
-                                                                       combo.add(\r
-                                                                               styleName,\r
-                                                                               style.type == CKEDITOR.STYLE_OBJECT ? styleName : style.buildPreview(),\r
-                                                                               styleName );\r
-                                                               }\r
-\r
-                                                               combo.commit();\r
-\r
-                                                       });\r
-                                       },\r
-\r
-                                       onClick : function( value )\r
-                                       {\r
-                                               editor.focus();\r
-                                               editor.fire( 'saveSnapshot' );\r
-\r
-                                               var style = styles[ value ],\r
-                                                       selection = editor.getSelection(),\r
-                                                       elementPath = new CKEDITOR.dom.elementPath( selection.getStartElement() );\r
-\r
-                                               style[ style.checkActive( elementPath ) ? 'remove' : 'apply' ]( editor.document );\r
-\r
-                                               editor.fire( 'saveSnapshot' );\r
-                                       },\r
-\r
-                                       onRender : function()\r
-                                       {\r
-                                               editor.on( 'selectionChange', function( ev )\r
-                                                       {\r
-                                                               var currentValue = this.getValue(),\r
-                                                                       elementPath = ev.data.path,\r
-                                                                       elements = elementPath.elements;\r
-\r
-                                                               // For each element into the elements path.\r
-                                                               for ( var i = 0, count = elements.length, element ; i < count ; i++ )\r
-                                                               {\r
-                                                                       element = elements[i];\r
-\r
-                                                                       // Check if the element is removable by any of\r
-                                                                       // the styles.\r
-                                                                       for ( var value in styles )\r
-                                                                       {\r
-                                                                               if ( styles[ value ].checkElementRemovable( element, true ) )\r
-                                                                               {\r
-                                                                                       if ( value != currentValue )\r
-                                                                                               this.setValue( value );\r
-                                                                                       return;\r
-                                                                               }\r
-                                                                       }\r
-                                                               }\r
-\r
-                                                               // If no styles match, just empty it.\r
-                                                               this.setValue( '' );\r
-                                                       },\r
-                                                       this);\r
-                                       },\r
-\r
-                                       onOpen : function()\r
-                                       {\r
-                                               if ( CKEDITOR.env.ie || CKEDITOR.env.webkit )\r
-                                                       editor.focus();\r
-\r
-                                               var selection = editor.getSelection(),\r
-                                                       element = selection.getSelectedElement(),\r
-                                                       elementPath = new CKEDITOR.dom.elementPath( element || selection.getStartElement() ),\r
-                                                       counter = [ 0, 0, 0, 0 ];\r
-\r
-                                               this.showAll();\r
-                                               this.unmarkAll();\r
-                                               for ( var name in styles )\r
-                                               {\r
-                                                       var style = styles[ name ],\r
-                                                               type = style.type;\r
-\r
-                                                       if ( style.checkActive( elementPath ) )\r
-                                                               this.mark( name );\r
-                                                       else if ( type == CKEDITOR.STYLE_OBJECT && !style.checkApplicable( elementPath ) )\r
-                                                       {\r
-                                                               this.hideItem( name );\r
-                                                               counter[ type ]--;\r
-                                                       }\r
-\r
-                                                       counter[ type ]++;\r
-                                               }\r
-\r
-                                               if ( !counter[ CKEDITOR.STYLE_BLOCK ] )\r
-                                                       this.hideGroup( lang[ 'panelTitle' + String( CKEDITOR.STYLE_BLOCK ) ] );\r
-\r
-                                               if ( !counter[ CKEDITOR.STYLE_INLINE ] )\r
-                                                       this.hideGroup( lang[ 'panelTitle' + String( CKEDITOR.STYLE_INLINE ) ] );\r
-\r
-                                               if ( !counter[ CKEDITOR.STYLE_OBJECT ] )\r
-                                                       this.hideGroup( lang[ 'panelTitle' + String( CKEDITOR.STYLE_OBJECT ) ] );\r
-                                       },\r
-\r
-                                       // Force a reload of the data\r
-                                       reset: function()\r
-                                       {\r
-                                               if ( combo )\r
-                                               {\r
-                                                       delete combo._.panel;\r
-                                                       delete combo._.list;\r
-                                                       combo._.committed = 0;\r
-                                                       combo._.items = {};\r
-                                                       combo._.state = CKEDITOR.TRISTATE_OFF;\r
-                                               }\r
-                                               styles = {};\r
-                                               stylesList = [];\r
-                                               loadStylesSet();\r
-                                       }\r
-                               });\r
-\r
-                       editor.on( 'instanceReady', function() { loadStylesSet(); } );\r
-               }\r
-       });\r
-\r
-       function sortStyles( styleA, styleB )\r
-       {\r
-               var typeA = styleA.type,\r
-                       typeB = styleB.type;\r
-\r
-               return typeA == typeB ? 0 :\r
-                       typeA == CKEDITOR.STYLE_OBJECT ? -1 :\r
-                       typeB == CKEDITOR.STYLE_OBJECT ? 1 :\r
-                       typeB == CKEDITOR.STYLE_BLOCK ? 1 :\r
-                       -1;\r
-       }\r
-})();\r