Ticket #2971: 2971_3.patch

File 2971_3.patch, 67.3 KB (added by Frederico Caldeira Knabben, 15 years ago)
  • _source/core/config.js

     
    147147         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    148148         */
    149149
    150         plugins : 'basicstyles,blockquote,button,clipboard,elementspath,find,flash,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,smiley,showblocks,sourcearea,table,specialchar,tab,templates,toolbar,undo,wysiwygarea',
     150        plugins : 'basicstyles,blockquote,button,clipboard,elementspath,find,flash,format,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,smiley,showblocks,sourcearea,table,specialchar,tab,templates,toolbar,undo,wysiwygarea',
    151151
    152152        /**
    153153         * The theme to be used to build the UI.
  • _source/core/dom/domobject.js

     
    147147         */
    148148        domObjectProto.setCustomData = function( key, value )
    149149        {
    150                 var expandoNumber = this.$._cke_expando || ( this.$._cke_expando = CKEDITOR.tools.getNextNumber() ),
     150                var expandoNumber = this.getUniqueId(),
    151151                        dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} );
    152152
    153153                dataSlot[ key ] = value;
     
    186186                return retval || null;
    187187        };
    188188
     189        domObjectProto.getUniqueId = function()
     190        {
     191                return this.$._cke_expando || ( this.$._cke_expando = CKEDITOR.tools.getNextNumber() );
     192        };
     193
    189194        // Implement CKEDITOR.event.
    190195        CKEDITOR.event.implementOn( domObjectProto );
    191196
  • _source/core/dom/element.js

     
    167167                        }
    168168                },
    169169
     170                hasClass : function( className )
     171                {
     172                        var regex = new RegExp( '(?:^|\\s+)' + className + '(?=\\s|$)', '' );
     173                        return regex.test( this.$.className );
     174                },
     175
    170176                /**
    171177                 * Append a node as a child of this element.
    172178                 * @param {CKEDITOR.dom.node|String} node The node or element name to be
     
    197203                        return node;
    198204                },
    199205
     206                appendHtml : function( html )
     207                {
     208                        var temp = new CKEDITOR.dom.element( 'div', this.getDocument() );
     209                        temp.setHtml( html );
     210                        temp.moveChildren( this );
     211                },
     212
    200213                /**
    201214                 * Append text to this element.
    202215                 * @param {String} text The text to be appended.
  • _source/core/editor.js

     
    7878                                if ( instanceConfig )
    7979                                        CKEDITOR.tools.extend( editor.config, instanceConfig, true );
    8080
    81                                 // Fire the "configLoaded" event.
    82                                 editor.fireOnce( 'configLoaded' );
    83 
    84                                 loadLang( editor );
     81                                onConfigLoaded( editor );
    8582                        });
    8683
    8784                // The instance config may override the customConfig setting to avoid
     
    9693
    9794        // ##### END: Config Privates
    9895
     96        var onConfigLoaded = function( editor )
     97        {
     98                // Set config related properties.
     99
     100                editor.skinPath = CKEDITOR.getUrl(
     101                        '_source/' +    // %REMOVE_LINE%
     102                        'skins/' + editor.config.skin + '/' );
     103
     104                // Fire the "configLoaded" event.
     105                editor.fireOnce( 'configLoaded' );
     106
     107                // Load language file.
     108                loadLang( editor );
     109        };
     110
    99111        var loadLang = function( editor )
    100112        {
    101113                CKEDITOR.lang.load( editor.config.defaultLanguage, editor.config.autoLanguage, function( languageCode, lang )
  • _source/core/plugins.js

     
    4848
    4949                                                if ( requiredPlugins.length )
    5050                                                        loadPlugins.call( this, requiredPlugins );
    51                                                 else if ( callback )
    52                                                         callback.call( scope || window, allPlugins );
     51                                                else
     52                                                {
     53                                                        // Call the "onLoad" function for all plugins.
     54                                                        for ( pluginName in allPlugins )
     55                                                        {
     56                                                                plugin = allPlugins[ pluginName ];
     57                                                                if ( plugin.onLoad && !plugin.onLoad._called )
     58                                                                {
     59                                                                        plugin.onLoad();
     60                                                                        plugin.onLoad._called = 1;
     61                                                                }
     62                                                        }
     63
     64                                                        // Call the callback.
     65                                                        if ( callback )
     66                                                                callback.call( scope || window, allPlugins );
     67                                                }
    5368                                        }
    5469                                        , this);
    5570
  • _source/core/tools.js

     
    88 *              utility functions.
    99 */
    1010
    11 /**
    12  * Utility functions.
    13  * @namespace
    14  * @example
    15  */
    16 CKEDITOR.tools =
     11(function()
    1712{
    18         arrayCompare : function( arrayA, arrayB )
    19         {
    20                 if ( !arrayA && !arrayB )
    21                         return true;
     13        var functions = [];
    2214
    23                 if ( !arrayA || !arrayB || arrayA.length != arrayB.length )
    24                         return false;
    25 
    26                 for ( var i = 0 ; i < arrayA.length ; i++ )
    27                 {
    28                         if ( arrayA[ i ] != arrayB[ i ] )
    29                                 return false;
    30                 }
    31 
    32                 return true;
    33         },
    34 
    3515        /**
    36          * Copy the properties from one object to another. By default, properties
    37          * already present in the target object <strong>are not</strong> overwritten.
    38          * @param {Object} target The object to be extended.
    39          * @param {Object} source[,souce(n)] The objects from which copy
    40          *              properties. Any number of objects can be passed to this function.
    41          * @param {Boolean} [overwrite] Indicates that properties already present
    42          *              in the target object must be overwritten. This must be the last
    43          *              parameter in the function call.
    44          * @returns {Object} the extended object (target).
     16         * Utility functions.
     17         * @namespace
    4518         * @example
    46          * // Create the sample object.
    47          * var myObject =
    48          * {
    49          *     prop1 : true
    50          * };
    51          *
    52          * // Extend the above object with two properties.
    53          * CKEDITOR.tools.extend( myObject,
    54          *     {
    55          *         prop2 : true,
    56          *         prop3 : true
    57          *     } );
    58          *
    59          * // Alert "prop1", "prop2" and "prop3".
    60          * for ( var p in myObject )
    61          *     alert( p );
    6219         */
    63         extend : function( target )
     20        CKEDITOR.tools =
    6421        {
    65                 var argsLength = arguments.length,
    66                         overwrite = arguments[ argsLength - 1 ];
     22                arrayCompare : function( arrayA, arrayB )
     23                {
     24                        if ( !arrayA && !arrayB )
     25                                return true;
    6726
    68                 if ( typeof overwrite == 'boolean' )
    69                         argsLength--;
    70                 else
    71                         overwrite = false;
     27                        if ( !arrayA || !arrayB || arrayA.length != arrayB.length )
     28                                return false;
    7229
    73                 for ( var i = 1 ; i < argsLength ; i++ )
     30                        for ( var i = 0 ; i < arrayA.length ; i++ )
     31                        {
     32                                if ( arrayA[ i ] != arrayB[ i ] )
     33                                        return false;
     34                        }
     35
     36                        return true;
     37                },
     38
     39                /**
     40                 * Copy the properties from one object to another. By default, properties
     41                 * already present in the target object <strong>are not</strong> overwritten.
     42                 * @param {Object} target The object to be extended.
     43                 * @param {Object} source[,souce(n)] The objects from which copy
     44                 *              properties. Any number of objects can be passed to this function.
     45                 * @param {Boolean} [overwrite] Indicates that properties already present
     46                 *              in the target object must be overwritten. This must be the last
     47                 *              parameter in the function call.
     48                 * @returns {Object} the extended object (target).
     49                 * @example
     50                 * // Create the sample object.
     51                 * var myObject =
     52                 * {
     53                 *     prop1 : true
     54                 * };
     55                 *
     56                 * // Extend the above object with two properties.
     57                 * CKEDITOR.tools.extend( myObject,
     58                 *     {
     59                 *         prop2 : true,
     60                 *         prop3 : true
     61                 *     } );
     62                 *
     63                 * // Alert "prop1", "prop2" and "prop3".
     64                 * for ( var p in myObject )
     65                 *     alert( p );
     66                 */
     67                extend : function( target )
    7468                {
    75                         var source = arguments[ i ];
     69                        var argsLength = arguments.length,
     70                                overwrite = arguments[ argsLength - 1 ];
    7671
    77                         for ( var propertyName in source )
     72                        if ( typeof overwrite == 'boolean' )
     73                                argsLength--;
     74                        else
     75                                overwrite = false;
     76
     77                        for ( var i = 1 ; i < argsLength ; i++ )
    7878                        {
    79                                 if ( overwrite || target[ propertyName ] == undefined )
    80                                         target[ propertyName ] = source[ propertyName ];
     79                                var source = arguments[ i ];
     80
     81                                for ( var propertyName in source )
     82                                {
     83                                        if ( overwrite || target[ propertyName ] == undefined )
     84                                                target[ propertyName ] = source[ propertyName ];
     85                                }
    8186                        }
    82                 }
    8387
    84                 return target;
    85         },
     88                        return target;
     89                },
    8690
    87         /**
    88         * Creates an object which is an instance of a class which prototype is a
    89         * predefined object. All properties defined in the source object are
    90         * automatically inherited by the resulting object, including future
    91         * changes to it.
    92         * @param {Object} source The source object to be used as the prototype for
    93         *              the final object.
    94         * @returns {Object} The resulting copy.
    95         */
    96         prototypedCopy : function( source )
    97         {
    98                 var copy = function()
    99                 {};
    100                 copy.prototype = source;
    101                 return new copy();
    102         },
     91                /**
     92                * Creates an object which is an instance of a class which prototype is a
     93                * predefined object. All properties defined in the source object are
     94                * automatically inherited by the resulting object, including future
     95                * changes to it.
     96                * @param {Object} source The source object to be used as the prototype for
     97                *              the final object.
     98                * @returns {Object} The resulting copy.
     99                */
     100                prototypedCopy : function( source )
     101                {
     102                        var copy = function()
     103                        {};
     104                        copy.prototype = source;
     105                        return new copy();
     106                },
    103107
    104         /**
    105         * Checks if an object is an Array.
    106         * @param {Object} object The object to be checked.
    107         * @type Boolean
    108         * @returns <i>true</i> if the object is an Array, otherwise <i>false</i>.
    109         * @example
    110         * alert( CKEDITOR.tools.isArray( [] ) );      // "true"
    111         * alert( CKEDITOR.tools.isArray( 'Test' ) );  // "false"
    112         */
    113         isArray : function( object )
    114         {
    115                 return ( !!object && object instanceof Array );
    116         },
     108                /**
     109                * Checks if an object is an Array.
     110                * @param {Object} object The object to be checked.
     111                * @type Boolean
     112                * @returns <i>true</i> if the object is an Array, otherwise <i>false</i>.
     113                * @example
     114                * alert( CKEDITOR.tools.isArray( [] ) );      // "true"
     115                * alert( CKEDITOR.tools.isArray( 'Test' ) );  // "false"
     116                */
     117                isArray : function( object )
     118                {
     119                        return ( !!object && object instanceof Array );
     120                },
    117121
    118         /**
    119          * Transforms a CSS property name to its relative DOM style name.
    120          * @param {String} cssName The CSS property name.
    121          * @returns {String} The transformed name.
    122          * @example
    123          * alert( CKEDITOR.tools.cssStyleToDomStyle( 'background-color' ) );  // "backgroundColor"
    124          * alert( CKEDITOR.tools.cssStyleToDomStyle( 'float' ) );             // "cssFloat"
    125          */
    126         cssStyleToDomStyle : function( cssName )
    127         {
    128                 if ( cssName == 'float' )
    129                         return 'cssFloat';
    130                 else
     122                /**
     123                 * Transforms a CSS property name to its relative DOM style name.
     124                 * @param {String} cssName The CSS property name.
     125                 * @returns {String} The transformed name.
     126                 * @example
     127                 * alert( CKEDITOR.tools.cssStyleToDomStyle( 'background-color' ) );  // "backgroundColor"
     128                 * alert( CKEDITOR.tools.cssStyleToDomStyle( 'float' ) );             // "cssFloat"
     129                 */
     130                cssStyleToDomStyle : function( cssName )
    131131                {
    132                         return cssName.replace( /-./g, function( match )
     132                        if ( cssName == 'float' )
     133                                return 'cssFloat';
     134                        else
     135                        {
     136                                return cssName.replace( /-./g, function( match )
     137                                        {
     138                                                return match.substr( 1 ).toUpperCase();
     139                                        });
     140                        }
     141                },
     142
     143                /**
     144                 * Replace special HTML characters in a string with their relative HTML
     145                 * entity values.
     146                 * @param {String} text The string to be encoded.
     147                 * @returns {String} The encode string.
     148                 * @example
     149                 * alert( CKEDITOR.tools.htmlEncode( 'A > B & C < D' ) );  // "A &amp;gt; B &amp;amp; C &amp;lt; D"
     150                 */
     151                htmlEncode : function( text )
     152                {
     153                        var standard = function( text )
     154                        {
     155                                var span = new CKEDITOR.dom.element( 'span' );
     156                                span.setText( text );
     157                                return span.getHtml();
     158                        };
     159
     160                        this.htmlEncode = ( standard( '>' ) == '>' ) ?
     161                                function( text )
    133162                                {
    134                                         return match.substr( 1 ).toUpperCase();
    135                                 });
    136                 }
    137         },
     163                                        // WebKit does't encode the ">" character, which makes sense, but
     164                                        // it's different than other browsers.
     165                                        return standard( text ).replace( />/g, '&gt;' );
     166                                } :
     167                                standard;
    138168
    139         /**
    140          * Replace special HTML characters in a string with their relative HTML
    141          * entity values.
    142          * @param {String} text The string to be encoded.
    143          * @returns {String} The encode string.
    144          * @example
    145          * alert( CKEDITOR.tools.htmlEncode( 'A > B & C < D' ) );  // "A &amp;gt; B &amp;amp; C &amp;lt; D"
    146          */
    147         htmlEncode : function( text )
    148         {
    149                 var standard = function( text )
     169                        return this.htmlEncode( text );
     170                },
     171
     172                /**
     173                 * Gets a unique number for this CKEDITOR execution session. It returns
     174                 * progressive numbers starting at 1.
     175                 * @function
     176                 * @returns {Number} A unique number.
     177                 * @example
     178                 * alert( CKEDITOR.tools.<b>getNextNumber()</b> );  // "1" (e.g.)
     179                 * alert( CKEDITOR.tools.<b>getNextNumber()</b> );  // "2"
     180                 */
     181                getNextNumber : (function()
    150182                {
    151                         var span = new CKEDITOR.dom.element( 'span' );
    152                         span.setText( text );
    153                         return span.getHtml();
    154                 };
    155 
    156                 this.htmlEncode = ( standard( '>' ) == '>' ) ?
    157                         function( text )
     183                        var last = 0;
     184                        return function()
    158185                        {
    159                                 // WebKit does't encode the ">" character, which makes sense, but
    160                                 // it's different than other browsers.
    161                                 return standard( text ).replace( />/g, '&gt;' );
    162                         } :
    163                         standard;
     186                                return ++last;
     187                        };
     188                })(),
    164189
    165                 return this.htmlEncode( text );
    166         },
     190                /**
     191                 * Creates a function override.
     192                 * @param {Function} originalFunction The function to be overridden.
     193                 * @param {Function} functionBuilder A function that returns the new
     194                 *              function. The original function reference will be passed to this
     195                 *              function.
     196                 * @returns {Function} The new function.
     197                 * @example
     198                 * var example =
     199                 * {
     200                 *     myFunction : function( name )
     201                 *     {
     202                 *         alert( 'Name: ' + name );
     203                 *     }
     204                 * };
     205                 *
     206                 * example.myFunction = CKEDITOR.tools.override( example.myFunction, function( myFunctionOriginal )
     207                 *     {
     208                 *         return function( name )
     209                 *             {
     210                 *                 alert( 'Override Name: ' + name );
     211                 *                 myFunctionOriginal.call( this, name );
     212                 *             };
     213                 *     });
     214                 */
     215                override : function( originalFunction, functionBuilder )
     216                {
     217                        return functionBuilder( originalFunction );
     218                },
    167219
    168         /**
    169          * Gets a unique number for this CKEDITOR execution session. It returns
    170          * progressive numbers starting at 1.
    171          * @function
    172          * @returns {Number} A unique number.
    173          * @example
    174          * alert( CKEDITOR.tools.<b>getNextNumber()</b> );  // "1" (e.g.)
    175          * alert( CKEDITOR.tools.<b>getNextNumber()</b> );  // "2"
    176          */
    177         getNextNumber : (function()
    178         {
    179                 var last = 0;
    180                 return function()
     220                /**
     221                 * Executes a function after specified delay.
     222                 * @param {Function} func The function to be executed.
     223                 * @param {Number} [milliseconds] The amount of time (millisecods) to wait
     224                 *              to fire the function execution. Defaults to zero.
     225                 * @param {Object} [scope] The object to hold the function execution scope
     226                 *              (the "this" object). By default the "window" object.
     227                 * @param {Object|Array} [args] A single object, or an array of objects, to
     228                 *              pass as arguments to the function.
     229                 * @param {Object} [ownerWindow] The window that will be used to set the
     230                 *              timeout. By default the current "window".
     231                 * @returns {Object} A value that can be used to cancel the function execution.
     232                 * @example
     233                 * CKEDITOR.tools.<b>setTimeout(
     234                 *     function()
     235                 *     {
     236                 *         alert( 'Executed after 2 seconds' );
     237                 *     },
     238                 *     2000 )</b>;
     239                 */
     240                setTimeout : function( func, milliseconds, scope, args, ownerWindow )
    181241                {
    182                         return ++last;
    183                 };
    184         })(),
     242                        if ( !ownerWindow )
     243                                ownerWindow = window;
    185244
    186         /**
    187          * Creates a function override.
    188          * @param {Function} originalFunction The function to be overridden.
    189          * @param {Function} functionBuilder A function that returns the new
    190          *              function. The original function reference will be passed to this
    191          *              function.
    192          * @returns {Function} The new function.
    193          * @example
    194          * var example =
    195          * {
    196          *     myFunction : function( name )
    197          *     {
    198          *         alert( 'Name: ' + name );
    199          *     }
    200          * };
    201          *
    202          * example.myFunction = CKEDITOR.tools.override( example.myFunction, function( myFunctionOriginal )
    203          *     {
    204          *         return function( name )
    205          *             {
    206          *                 alert( 'Override Name: ' + name );
    207          *                 myFunctionOriginal.call( this, name );
    208          *             };
    209          *     });
    210          */
    211         override : function( originalFunction, functionBuilder )
    212         {
    213                 return functionBuilder( originalFunction );
    214         },
     245                        if ( !scope )
     246                                scope = ownerWindow;
    215247
    216         /**
    217          * Executes a function after specified delay.
    218          * @param {Function} func The function to be executed.
    219          * @param {Number} [milliseconds] The amount of time (millisecods) to wait
    220          *              to fire the function execution. Defaults to zero.
    221          * @param {Object} [scope] The object to hold the function execution scope
    222          *              (the "this" object). By default the "window" object.
    223          * @param {Object|Array} [args] A single object, or an array of objects, to
    224          *              pass as arguments to the function.
    225          * @param {Object} [ownerWindow] The window that will be used to set the
    226          *              timeout. By default the current "window".
    227          * @returns {Object} A value that can be used to cancel the function execution.
    228          * @example
    229          * CKEDITOR.tools.<b>setTimeout(
    230          *     function()
    231          *     {
    232          *         alert( 'Executed after 2 seconds' );
    233          *     },
    234          *     2000 )</b>;
    235          */
    236         setTimeout : function( func, milliseconds, scope, args, ownerWindow )
    237         {
    238                 if ( !ownerWindow )
    239                         ownerWindow = window;
     248                        return ownerWindow.setTimeout(
     249                                function()
     250                                {
     251                                        if ( args )
     252                                                func.apply( scope, [].concat( args ) ) ;
     253                                        else
     254                                                func.apply( scope ) ;
     255                                },
     256                                milliseconds || 0 );
     257                },
    240258
    241                 if ( !scope )
    242                         scope = ownerWindow;
     259                /**
     260                 * Remove spaces from the start and the end of a string. The following
     261                 * characters are removed: space, tab, line break, line feed.
     262                 * @function
     263                 * @param {String} str The text from which remove the spaces.
     264                 * @returns {String} The modified string without the boundary spaces.
     265                 * @example
     266                 * alert( CKEDITOR.tools.trim( '  example ' );  // "example"
     267                 */
     268                trim : (function()
     269                {
     270                        // We are not using \s because we don't want "non-breaking spaces" to be caught.
     271                        var trimRegex = /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;
     272                        return function( str )
     273                        {
     274                                return str.replace( trimRegex, '' ) ;
     275                        };
     276                })(),
    243277
    244                 return ownerWindow.setTimeout(
    245                         function()
     278                /**
     279                 * Remove spaces from the start (left) of a string. The following
     280                 * characters are removed: space, tab, line break, line feed.
     281                 * @function
     282                 * @param {String} str The text from which remove the spaces.
     283                 * @returns {String} The modified string excluding the removed spaces.
     284                 * @example
     285                 * alert( CKEDITOR.tools.ltrim( '  example ' );  // "example "
     286                 */
     287                ltrim : (function()
     288                {
     289                        // We are not using \s because we don't want "non-breaking spaces" to be caught.
     290                        var trimRegex = /^[ \t\n\r]+/g;
     291                        return function( str )
    246292                        {
    247                                 if ( args )
    248                                         func.apply( scope, [].concat( args ) ) ;
    249                                 else
    250                                         func.apply( scope ) ;
    251                         },
    252                         milliseconds || 0 );
    253         },
     293                                return str.replace( trimRegex, '' ) ;
     294                        };
     295                })(),
    254296
    255         /**
    256          * Remove spaces from the start and the end of a string. The following
    257          * characters are removed: space, tab, line break, line feed.
    258          * @function
    259          * @param {String} str The text from which remove the spaces.
    260          * @returns {String} The modified string without the boundary spaces.
    261          * @example
    262          * alert( CKEDITOR.tools.trim( '  example ' );  // "example"
    263          */
    264         trim : (function()
    265         {
    266                 // We are not using \s because we don't want "non-breaking spaces" to be caught.
    267                 var trimRegex = /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;
    268                 return function( str )
     297                /**
     298                 * Remove spaces from the end (right) of a string. The following
     299                 * characters are removed: space, tab, line break, line feed.
     300                 * @function
     301                 * @param {String} str The text from which remove the spaces.
     302                 * @returns {String} The modified string excluding the removed spaces.
     303                 * @example
     304                 * alert( CKEDITOR.tools.ltrim( '  example ' );  // "  example"
     305                 */
     306                rtrim : (function()
    269307                {
    270                         return str.replace( trimRegex, '' ) ;
    271                 };
    272         })(),
     308                        // We are not using \s because we don't want "non-breaking spaces" to be caught.
     309                        var trimRegex = /[ \t\n\r]+$/g;
     310                        return function( str )
     311                        {
     312                                return str.replace( trimRegex, '' ) ;
     313                        };
     314                })(),
    273315
    274         /**
    275          * Remove spaces from the start (left) of a string. The following
    276          * characters are removed: space, tab, line break, line feed.
    277          * @function
    278          * @param {String} str The text from which remove the spaces.
    279          * @returns {String} The modified string excluding the removed spaces.
    280          * @example
    281          * alert( CKEDITOR.tools.ltrim( '  example ' );  // "example "
    282          */
    283         ltrim : (function()
    284         {
    285                 // We are not using \s because we don't want "non-breaking spaces" to be caught.
    286                 var trimRegex = /^[ \t\n\r]+/g;
    287                 return function( str )
     316                /**
     317                 * Returns the index of an element in an array.
     318                 * @param {Array} array The array to be searched.
     319                 * @param {Object} entry The element to be found.
     320                 * @returns {Number} The (zero based) index of the first entry that matches
     321                 *              the entry, or -1 if not found.
     322                 * @example
     323                 * var letters = [ 'a', 'b', 0, 'c', false ];
     324                 * alert( CKEDITOR.tools.indexOf( letters, '0' ) );  "-1" because 0 !== '0'
     325                 * alert( CKEDITOR.tools.indexOf( letters, false ) );  "4" because 0 !== false
     326                 */
     327                indexOf :
     328                        // #2514: We should try to use Array.indexOf if it does exist.
     329                        ( Array.prototype.indexOf ) ?
     330                                function( array, entry )
     331                                        {
     332                                                return array.indexOf( entry );
     333                                        }
     334                        :
     335                                function( array, entry )
     336                                {
     337                                        for ( var i = 0, len = array.length ; i < len ; i++ )
     338                                        {
     339                                                if ( array[ i ] === entry )
     340                                                        return i;
     341                                        }
     342                                        return -1;
     343                                },
     344
     345                bind : function( func, obj )
    288346                {
    289                         return str.replace( trimRegex, '' ) ;
    290                 };
    291         })(),
     347                        return function() { return func.apply( obj, arguments ); };
     348                },
    292349
    293         /**
    294          * Remove spaces from the end (right) of a string. The following
    295          * characters are removed: space, tab, line break, line feed.
    296          * @function
    297          * @param {String} str The text from which remove the spaces.
    298          * @returns {String} The modified string excluding the removed spaces.
    299          * @example
    300          * alert( CKEDITOR.tools.ltrim( '  example ' );  // "  example"
    301          */
    302         rtrim : (function()
    303         {
    304                 // We are not using \s because we don't want "non-breaking spaces" to be caught.
    305                 var trimRegex = /[ \t\n\r]+$/g;
    306                 return function( str )
     350                createClass : function( definition )
    307351                {
    308                         return str.replace( trimRegex, '' ) ;
    309                 };
    310         })(),
     352                        var $ = definition.$,
     353                                baseClass = definition.base,
     354                                privates = definition.privates || definition._,
     355                                proto = definition.proto,
     356                                statics = definition.statics;
    311357
    312         /**
    313          * Returns the index of an element in an array.
    314          * @param {Array} array The array to be searched.
    315          * @param {Object} entry The element to be found.
    316          * @returns {Number} The (zero based) index of the first entry that matches
    317          *              the entry, or -1 if not found.
    318          * @example
    319          * var letters = [ 'a', 'b', 0, 'c', false ];
    320          * alert( CKEDITOR.tools.indexOf( letters, '0' ) );  "-1" because 0 !== '0'
    321          * alert( CKEDITOR.tools.indexOf( letters, false ) );  "4" because 0 !== false
    322          */
    323         indexOf :
    324                 // #2514: We should try to use Array.indexOf if it does exist.
    325                 ( Array.prototype.indexOf ) ?
    326                         function( array, entry )
     358                        if ( privates )
     359                        {
     360                                var originalConstructor = $;
     361                                $ = function()
    327362                                {
    328                                         return array.indexOf( entry );
    329                                 }
    330                 :
    331                         function( array, entry )
     363                                        originalConstructor.apply( this, arguments );
     364                                       
     365                                        // Create (and get) the private namespace.
     366                                        var _ = this._ || ( this._ = {} );
     367                                       
     368                                        // Make some magic so "this" will refer to the main
     369                                        // instance when coding private functions.
     370                                        for ( var privateName in privates )
     371                                        {
     372                                                var priv = privates[ privateName ];
     373                                               
     374                                                _[ privateName ] =
     375                                                        ( typeof priv == 'function' ) ? CKEDITOR.tools.bind( priv, this ) : priv;
     376                                        }
     377                                };
     378                        }
     379
     380                        if ( baseClass )
    332381                        {
    333                                 for ( var i = 0, len = array.length ; i < len ; i++ )
     382                                $.prototype = this.prototypedCopy( baseClass.prototype );
     383
     384                                $.prototype.base = function()
    334385                                {
    335                                         if ( array[ i ] === entry )
    336                                                 return i;
    337                                 }
    338                                 return -1;
    339                         },
     386                                        this.base = baseClass.prototype.base;
     387                                        baseClass.apply( this, arguments );
     388                                        this.base = arguments.callee;
     389                                };
     390                        }
    340391
    341         bind : function( func, obj )
    342         {
    343                 return function() { return func.apply( obj, arguments ); };
    344         }
    345 };
     392                        if ( proto )
     393                                this.extend( $.prototype, proto, true );
    346394
     395                        if ( statics )
     396                                this.extend( $, statics, true );
     397
     398                        return $;
     399                },
     400
     401                addFunction : function( fn, scope )
     402                {
     403                        return functions.push( function()
     404                                {
     405                                        fn.apply( scope || this, arguments );
     406                                }) - 1;
     407                },
     408
     409                callFunction : function( index )
     410                {
     411                        var fn = functions[ index ];
     412                        return fn.apply( window, Array.prototype.slice.call( arguments, 1 ) );
     413                }
     414        };
     415})();
     416
    347417// PACKAGER_RENAME( CKEDITOR.tools )
  • _source/core/ui.js

     
    4848         */
    4949        add : function( name, type, definition )
    5050        {
    51                 var item = this._.handlers[ type ].create( definition );
    52                 item.name = name;
    53                 this._.items[ name ] = item;
     51                this._.items[ name ] =
     52                {
     53                        type : type,
     54                        args : Array.prototype.slice.call( arguments, 2 )
     55                };
    5456        },
    5557
    5658        /**
     
    5860         * @param {String} name The UI item hame.
    5961         * @example
    6062         */
    61         get : function( name )
     63        create : function( name )
    6264        {
    63                 return this._.items[ name ] || null;
     65                var item        = this._.items[ name ],
     66                        handler = item && this._.handlers[ item.type ];
     67               
     68                return handler && handler.create.apply( this, item.args );
    6469        },
    6570
    6671        /**
  • _source/lang/en.js

     
    436436                emptyListMsg : '(No templates defined)'
    437437        },
    438438
    439         showBlocks : 'Show Blocks'
     439        showBlocks : 'Show Blocks',
     440
     441        format :
     442        {
     443                label : 'Format',
     444                panelTitle : 'Paragraph Format',
     445
     446                tag_p : 'Normal',
     447                tag_pre : 'Formatted',
     448                tag_address : 'Address',
     449                tag_h1 : 'Heading 1',
     450                tag_h2 : 'Heading 2',
     451                tag_h3 : 'Heading 3',
     452                tag_h4 : 'Heading 4',
     453                tag_h5 : 'Heading 5',
     454                tag_h6 : 'Heading 6',
     455                tag_div : 'Normal (DIV)'
     456        }
    440457};
  • _source/plugins/floatpanel/plugin.js

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6CKEDITOR.plugins.add( 'floatpanel',
     7{
     8        requires : [ 'panel' ]
     9});
     10
     11(function()
     12{
     13        var panels = {};
     14
     15        function getPanel( doc, parentElement, definition )
     16        {
     17                // Generates the panel key: docId-eleId-CSSs
     18                var key =
     19                        doc.getUniqueId() +
     20                        '-' + parentElement.getUniqueId() +
     21                        ( ( definition.css && ( '-' + definition.css ) ) || '' );
     22
     23                var panel = panels[ key ];
     24
     25                if ( !panel )
     26                {
     27                        panel = panels[ key ] = new CKEDITOR.ui.panel( doc, definition );
     28                        panel.element = parentElement.append( CKEDITOR.dom.element.createFromHtml( panel.renderHtml(), doc ) );
     29
     30                        panel.element.setStyles(
     31                                {
     32                                        display : 'none',
     33                                        position : 'absolute'
     34                                });
     35                }
     36
     37                return panel;
     38        }
     39
     40        CKEDITOR.ui.floatPanel = CKEDITOR.tools.createClass(
     41        {
     42                $ : function( parentElement, definition )
     43                {
     44                        definition.forceIFrame = true;
     45
     46                        var doc = parentElement.getDocument(),
     47                                panel = getPanel( doc, parentElement, definition ),
     48                                element = panel.element,
     49                                iframe = element.getFirst();
     50
     51                        this.element = element;
     52
     53                        this._ =
     54                        {
     55                                // The panel that will be floating.
     56                                panel : panel,
     57                                document : doc,
     58                                iframe : iframe
     59                        }
     60                },
     61
     62                proto :
     63                {
     64                        addBlock : function( name, block )
     65                        {
     66                                return this._.panel.addBlock( name, block );
     67                        },
     68
     69                        addListBlock : function( name, multiSelect )
     70                        {
     71                                return this._.panel.addListBlock( name, multiSelect );
     72                        },
     73
     74                        showBlock : function( name, offsetParent, corner, offsetX, offsetY )
     75                        {
     76                                this._.panel.showBlock( name );
     77
     78                                var element = this.element,
     79                                        iframe = this._.iframe,
     80                                        position = offsetParent.getDocumentPosition();
     81
     82                                var left        = position.x + ( offsetX || 0 ),
     83                                        top             = position.y + ( offsetY || 0 );
     84
     85                                if ( corner == 2 || corner == 3 )
     86                                        left += offsetParent.$.offsetWidth - 1;
     87
     88                                if ( corner == 3 || corner == 4 )
     89                                        top += offsetParent.$.offsetHeight - 1;
     90
     91                                element.setStyles(
     92                                        {
     93                                                left    : left + 'px',
     94                                                top             : top + 'px',
     95                                                display : ''
     96                                        });
     97
     98                                // Configure the IFrame blur event. Do that only once.
     99                                if ( !this._.blurSet )
     100                                {
     101                                        // Non IE prefer the event into a window object.
     102                                        var focused = CKEDITOR.env.ie ? iframe : new CKEDITOR.dom.window( iframe.$.contentWindow );
     103
     104                                        focused.on( 'blur', CKEDITOR.tools.bind( this.hide, this ) );
     105
     106                                        this._.blurSet = 1;
     107                                }
     108
     109                                // Set the IFrame focus, so the blur event gets fired.
     110                                setTimeout( function()
     111                                        {
     112                                                iframe.$.contentWindow.focus();
     113                                        }, 0);
     114
     115                                if ( this.onShow )
     116                                        this.onShow.call( this );
     117                        },
     118
     119                        hide : function()
     120                        {
     121                                if ( !this.onHide || this.onHide.call( this ) !== true )
     122                                        this.element.setStyle( 'display', 'none' );
     123                        }
     124                }
     125        });
     126})();
  • _source/plugins/format/plugin.js

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6CKEDITOR.plugins.add( 'format',
     7{
     8        requires : [ 'richcombo' ],
     9
     10        init : function( editor )
     11        {
     12                var config = editor.config,
     13                        lang = editor.lang.format;
     14
     15                var saveRanges;
     16
     17                // Gets the list of tags from the settings.
     18                var tags = config.format_tags.split( ',' );
     19
     20                // Create style objects for all defined styles.
     21                var styles = {};
     22                for ( var i = 0 ; i < tags.length ; i++ )
     23                {
     24                        var tag = tags[ i ];
     25                        styles[ tag ] = new CKEDITOR.style( config[ 'format_' + tag ] );
     26                }
     27
     28                editor.ui.addRichCombo( 'Format',
     29                        {
     30                                label : lang.label,
     31                                title : lang.panelTitle,
     32                                className : 'cke_format',
     33                                multiSelect : false,
     34
     35                                panel :
     36                                {
     37                                        css : [ config.contentsCss, editor.skinPath + 'editor.css' ],
     38                                        className : 'cke_skin_default'
     39                                },
     40
     41                                init : function()
     42                                {
     43                                        this.startGroup( lang.panelTitle );
     44
     45                                        for ( var tag in styles )
     46                                        {
     47                                                var label = lang[ 'tag_' + tag ];
     48
     49                                                // Add the tag entry to the panel list.
     50                                                this.add( tag, '<' + tag + '>' + label + '</' + tag + '>', label );
     51                                        }
     52                                },
     53
     54                                onClick : function( value )
     55                                {
     56                                        editor.focus();
     57
     58                                        if ( saveRanges )
     59                                        {
     60                                                editor.getSelection().selectRanges( saveRanges );
     61                                                saveRanges = false;
     62                                        }
     63
     64                                        styles[ value ].apply( editor.document );
     65                                },
     66
     67                                onRender : function()
     68                                {
     69                                        editor.on( 'selectionChange', function( ev )
     70                                                {
     71                                                        var currentTag = this.getValue();
     72
     73                                                        var elementPath = ev.data.path;
     74
     75                                                        for ( var tag in styles )
     76                                                        {
     77                                                                if ( styles[ tag ].checkActive( elementPath ) )
     78                                                                {
     79                                                                        if ( tag != currentTag )
     80                                                                                this.setValue( tag, editor.lang.format[ 'tag_' + tag ] );
     81                                                                        return;
     82                                                                }
     83                                                        }
     84
     85                                                        // If no styles match, just empty it.
     86                                                        this.setValue( '' );
     87                                                },
     88                                                this);
     89                                },
     90
     91                                onOpen : function()
     92                                {
     93                                        if ( CKEDITOR.env.ie )
     94                                        {
     95                                                editor.focus();
     96                                                saveRanges = editor.getSelection().getRanges();
     97                                        }
     98                                },
     99
     100                                onClose : function()
     101                                {
     102                                        saveRanges = null;
     103                                }
     104                        });
     105        }
     106});
     107
     108CKEDITOR.config.format_tags = 'p,h1,h2,h3,h4,h5,h6,pre,address,div';
     109
     110CKEDITOR.config.format_p                = { element : 'p' };
     111CKEDITOR.config.format_div              = { element : 'div' };
     112CKEDITOR.config.format_pre              = { element : 'pre' };
     113CKEDITOR.config.format_address  = { element : 'address' };
     114CKEDITOR.config.format_h1               = { element : 'h1' };
     115CKEDITOR.config.format_h2               = { element : 'h2' };
     116CKEDITOR.config.format_h3               = { element : 'h3' };
     117CKEDITOR.config.format_h4               = { element : 'h4' };
     118CKEDITOR.config.format_h5               = { element : 'h5' };
     119CKEDITOR.config.format_h6               = { element : 'h6' };
  • _source/plugins/listblock/plugin.js

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6CKEDITOR.plugins.add( 'listblock',
     7{
     8        requires : [ 'panel' ],
     9       
     10        onLoad : function()
     11        {
     12                CKEDITOR.ui.panel.prototype.addListBlock = function( name, multiSelect )
     13                {
     14                        return this.addBlock( name, new CKEDITOR.ui.listBlock( this.getHolderElement(), multiSelect ) );
     15                };
     16
     17                CKEDITOR.ui.listBlock = CKEDITOR.tools.createClass(
     18                        {
     19                                base : CKEDITOR.ui.panel.block,
     20
     21                                $ : function( blockHolder, multiSelect )
     22                                {
     23                                        // Call the base contructor.
     24                                        this.base( blockHolder );
     25
     26                                        this.multiSelect = !!multiSelect;
     27
     28                                        this._ =
     29                                        {
     30                                                pendingHtml : [],
     31                                                items : {}
     32                                        };
     33                                },
     34
     35                                _ :
     36                                {
     37                                        close : function()
     38                                        {
     39                                                if ( this._.started )
     40                                                {
     41                                                        this._.pendingHtml.push( '</ul>' );
     42                                                        delete this._.started;
     43                                                }
     44                                        },
     45
     46                                        getClick : function()
     47                                        {
     48                                                if ( !this._.click )
     49                                                {
     50                                                        this._.click = CKEDITOR.tools.addFunction( function( value )
     51                                                                {
     52                                                                        var marked = true;
     53
     54                                                                        if ( this.multiSelect )
     55                                                                                marked = this.toggle( value );
     56                                                                        else
     57                                                                                this.mark( value );
     58
     59                                                                        if ( this.onClick )
     60                                                                                this.onClick( value, marked );
     61                                                                },
     62                                                                this );
     63                                                }
     64                                                return this._.click;
     65                                        }
     66                                },
     67
     68                                proto :
     69                                {
     70                                        add : function( value, html )
     71                                        {
     72                                                var pendingHtml = this._.pendingHtml,
     73                                                        id = CKEDITOR.tools.getNextNumber();
     74
     75                                                if ( !this._.started )
     76                                                {
     77                                                        pendingHtml.push( '<ul class=cke_panel_list>' );
     78                                                        this._.started = 1;
     79                                                }
     80
     81                                                this._.items[ value ] = id;
     82
     83                                                pendingHtml.push( '<li id=cke_', id, ' class=cke_panel_listItem><a hidefocus=true href="javascript:void(\'', value, '\')" onclick="CKEDITOR.tools.callFunction(', this._.getClick(), ',\'', value, '\');">', html || value, '</a></li>' );
     84                                        },
     85
     86                                        startGroup : function( title )
     87                                        {
     88                                                this._.close();
     89                                                this._.pendingHtml.push( '<h1 class=cke_panel_grouptitle>', title, '</h1>' );
     90                                        },
     91
     92                                        commit : function()
     93                                        {
     94                                                this._.close();
     95                                                this.element.appendHtml( this._.pendingHtml.join( '' ) );
     96                                        },
     97
     98                                        toggle : function( value )
     99                                        {
     100                                                var isMarked = this.isMarked( value );
     101
     102                                                if ( isMarked )
     103                                                        this.unmark( value );
     104                                                else
     105                                                        this.mark( value );
     106
     107                                                return !isMarked;
     108                                        },
     109
     110                                        mark : function( value )
     111                                        {
     112                                                if ( !this.multiSelect )
     113                                                        this.unmarkAll();
     114
     115                                                this.element.getDocument().getById( 'cke_' + this._.items[ value ] ).addClass( 'cke_selected' );
     116                                        },
     117
     118                                        unmark : function( value )
     119                                        {
     120                                                this.element.getDocument().getById( 'cke_' + this._.items[ value ] ).removeClass( 'cke_selected' );
     121                                        },
     122
     123                                        unmarkAll : function()
     124                                        {
     125                                                var items = this._.items,
     126                                                        doc = this.element.getDocument();
     127
     128                                                for ( var value in items )
     129                                                {
     130                                                        doc.getById( 'cke_' + items[ value ] ).removeClass( 'cke_selected' );
     131                                                }
     132                                        },
     133
     134                                        isMarked : function( value )
     135                                        {
     136                                                return this.element.getDocument().getById( 'cke_' + this._.items[ value ] ).hasClass( 'cke_selected' );
     137                                        }
     138                                }
     139                        });
     140        }
     141});
     142
     143
  • _source/plugins/panel/plugin.js

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6CKEDITOR.plugins.add( 'panel',
     7{
     8        beforeInit : function( editor )
     9        {
     10                editor.ui.addHandler( CKEDITOR.UI_PANEL, CKEDITOR.ui.panel.handler );
     11        }
     12});
     13
     14/**
     15 * Panel UI element.
     16 * @constant
     17 * @example
     18 */
     19CKEDITOR.UI_PANEL = 2;
     20
     21CKEDITOR.ui.panel = function( document, definition )
     22{
     23        // Copy all definition properties to this object.
     24        if ( definition )
     25                CKEDITOR.tools.extend( this, definition );
     26
     27        // Set defaults.
     28        CKEDITOR.tools.extend( this,
     29                {
     30                        className : '',
     31                        css : []
     32                });
     33
     34        this.id = CKEDITOR.tools.getNextNumber();
     35        this.document = document;
     36
     37        this._ =
     38        {
     39                blocks : {}
     40        };
     41};
     42
     43/**
     44 * Transforms a rich combo definition in a {@link CKEDITOR.ui.richCombo}
     45 * instance.
     46 * @type Object
     47 * @example
     48 */
     49CKEDITOR.ui.panel.handler =
     50{
     51        create : function( definition )
     52        {
     53                return new CKEDITOR.ui.panel( definition );
     54        }
     55};
     56
     57CKEDITOR.ui.panel.prototype =
     58{
     59        renderHtml : function()
     60        {
     61                var output = [];
     62                this.render( output );
     63                return output.join( '' );
     64        },
     65
     66        /**
     67         * Renders the combo.
     68         * @param {CKEDITOR.editor} editor The editor instance which this button is
     69         *              to be used by.
     70         * @param {Array} output The output array to which append the HTML relative
     71         *              to this button.
     72         * @example
     73         */
     74        render : function( output )
     75        {
     76                var id = 'cke_' + this.id;
     77
     78                output.push(
     79                        '<div id=', id,
     80                                ' class="cke_panel' );
     81
     82                if ( this.className )
     83                        output.push( ' ', this.className);
     84
     85                output.push(
     86                         '">');
     87
     88                if ( this.forceIFrame || this.css.length )
     89                {
     90                        output.push(
     91                                '<iframe id="', id, '_frame"' +
     92                                        ' frameborder="0"' +
     93                                        ' src="javascript:void(0)"' +
     94                                '></iframe>' );
     95                }
     96
     97                output.push(
     98                        '</div>' );
     99
     100                return id;
     101        },
     102
     103        getHolderElement : function()
     104        {
     105                var holder = this._.holder;
     106
     107                if ( !holder )
     108                {
     109                        if ( this.forceIFrame || this.css.length )
     110                        {
     111                                var iframe = this.document.getById( 'cke_' + this.id + '_frame' );
     112                                var doc = new CKEDITOR.dom.document( iframe.$.contentWindow.document );
     113                               
     114                                // Initialize the IFRAME document body.
     115                                doc.$.open();
     116                                doc.$.write(
     117                                        '<!DOCTYPE html>' +
     118                                        '<html>' +
     119                                                '<head>' +
     120                                                        '<link type="text/css" rel=stylesheet href="' + this.css.join( '"><link type="text/css" rel="stylesheet" href="' ) + '">' +
     121                                                '</head>' +
     122                                                '<body class="cke_panel_frame" style="margin:0;padding:0">' +
     123                                                '</body>' +
     124                                        '<\/html>' );
     125                                doc.$.close();
     126
     127                                // Register the CKEDITOR global.
     128                                doc.getWindow().$.CKEDITOR = CKEDITOR;
     129
     130                                holder = doc.getBody();
     131                        }
     132                        else
     133                                holder = this.document.getById( 'cke_' + this.id );
     134
     135                        this._.holder = holder;
     136                }
     137
     138                return holder;
     139        },
     140
     141        addBlock : function( name, block )
     142        {
     143                block = this._.blocks[ name ] = block || new CKEDITOR.ui.panel.block( this.getHolderElement() );
     144
     145                if ( !this._.currentBlock )
     146                        this.showBlock( name );
     147
     148                return block;
     149        },
     150
     151        showBlock : function( name )
     152        {
     153                var blocks = this._.blocks,
     154                        block = blocks[ name ],
     155                        current = this._.currentBlock;
     156
     157                if ( current )
     158                        current.hide();
     159
     160                this._.currentBlock = block;
     161
     162                block.show();
     163        }
     164};
     165
     166CKEDITOR.ui.panel.block = function( blockHolder )
     167{
     168        this.element = blockHolder.append(
     169                blockHolder.getDocument().createElement( 'div',
     170                        {
     171                                attributes :
     172                                {
     173                                        'class' : 'cke_panel_block'
     174                                },
     175                                styles :
     176                                {
     177                                        display : 'none'
     178                                }
     179                        }) );
     180};
     181
     182CKEDITOR.ui.panel.block.prototype =
     183{
     184        show : function()
     185        {
     186                this.element.setStyle( 'display', '' );
     187        },
     188
     189        hide : function()
     190        {
     191                this.element.setStyle( 'display', 'none' );
     192        }
     193};
  • _source/plugins/richcombo/plugin.js

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6CKEDITOR.plugins.add( 'richcombo',
     7{
     8        requires : [ 'floatpanel', 'listblock' ],
     9
     10        beforeInit : function( editor )
     11        {
     12                editor.ui.addHandler( CKEDITOR.UI_RICHCOMBO, CKEDITOR.ui.richCombo.handler );
     13        }
     14});
     15
     16/**
     17 * Button UI element.
     18 * @constant
     19 * @example
     20 */
     21CKEDITOR.UI_RICHCOMBO = 3;
     22
     23CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass(
     24{
     25        $ : function( definition )
     26        {
     27                // Copy all definition properties to this object.
     28                CKEDITOR.tools.extend( this, definition,
     29                        // Set defaults.
     30                        {
     31                                title : definition.label
     32                        });
     33
     34                // We don't want the panel definition in this object.
     35                delete this.panel;
     36
     37                this.id = CKEDITOR.tools.getNextNumber();
     38
     39                this.document = ( definition.panel
     40                                                        && definition.panel.parent
     41                                                        && definition.panel.parent.getDocument() )
     42                                                || CKEDITOR.document;
     43
     44                this._ =
     45                {
     46                        panelDefinition : definition.panel,
     47                        items : {}
     48                };
     49        },
     50
     51        statics :
     52        {
     53                handler :
     54                {
     55                        create : function( definition )
     56                        {
     57                                return new CKEDITOR.ui.richCombo( definition );
     58                        }
     59                }
     60        },
     61
     62        proto :
     63        {
     64                renderHtml : function( editor )
     65                {
     66                        var output = [];
     67                        this.render( editor, output );
     68                        return output.join( '' );
     69                },
     70
     71                /**
     72                 * Renders the combo.
     73                 * @param {CKEDITOR.editor} editor The editor instance which this button is
     74                 *              to be used by.
     75                 * @param {Array} output The output array to which append the HTML relative
     76                 *              to this button.
     77                 * @example
     78                 */
     79                render : function( editor, output )
     80                {
     81                        var id = 'cke_' + this.id;
     82
     83                        var clickFn = CKEDITOR.tools.addFunction( function( $element )
     84                                {
     85                                        var _ = this._;
     86
     87                                        this.createPanel();
     88
     89                                        if ( _.on )
     90                                        {
     91                                                _.panel.hide();
     92                                                return;
     93                                        }
     94
     95                                        if ( !_.committed )
     96                                        {
     97                                                _.list.commit();
     98                                                _.committed = 1;
     99                                        }
     100                                       
     101                                        var value = this.getValue();
     102                                        if ( value )
     103                                                _.list.mark( value );
     104                                        else
     105                                                _.list.unmarkAll();
     106                                       
     107                                        _.panel.showBlock( this.id, new CKEDITOR.dom.element( $element ).getFirst(), 4 );
     108                                },
     109                                this );
     110                       
     111                        output.push(
     112                                '<span id=', id, ' class="cke_rcombo' );
     113
     114                        if ( this.className )
     115                                output.push( ' ', this.className);
     116
     117                        output.push(
     118                                 '">' +
     119                                        '<span class=cke_label>', this.label, '</span>' +
     120                                        '<a hidefocus=true title="', this.title, '" href="javascript:void(\'', this.label, '\')"' );
     121
     122                        // Some browsers don't cancel key events in the keydown but in the
     123                        // keypress.
     124                        // TODO: Check if really needed for Gecko+Mac.
     125                        if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
     126                        {
     127                                output.push(
     128                                        ' onkeypress="return false;"' );
     129                        }
     130
     131                        // With Firefox, we need to force it to redraw, otherwise it
     132                        // will remain in the focus state.
     133                        if ( CKEDITOR.env.gecko )
     134                        {
     135                                output.push(
     136                                        ' onblur="this.style.cssText = this.style.cssText;"' );
     137                        }
     138
     139                        output.push(
     140//                                      ' onkeydown="return CKEDITOR.ui.button._.keydown(', id, ', event);"' +
     141                                        ' onmousedown="CKEDITOR.tools.callFunction(', clickFn, ', this);">' +
     142                                                '<span id="', id, '_text" class=cke_text>&nbsp;</span>' +
     143                                                '<span class=cke_openbutton></span>' +
     144                                        '</a>' +
     145                                '</span>' );
     146
     147                        if ( this.onRender )
     148                                this.onRender();
     149
     150                        return {
     151                                id : id,
     152                                combo : this,
     153                                focus : function()
     154                                {
     155                                        var element = CKEDITOR.document.getById( id ).getChild( 1 );
     156                                        element.focus();
     157                                },
     158                                execute : clickFn
     159                        };
     160                },
     161
     162                createPanel : function()
     163                {
     164                        if ( this._.panel )
     165                                return;
     166
     167                        var panelDefinition = this._.panelDefinition || {},
     168                                panelParentElement = panelDefinition.parent || CKEDITOR.document.getBody(),
     169                                panel = new CKEDITOR.ui.floatPanel( panelParentElement, panelDefinition ),
     170                                list = panel.addListBlock( this.id, this.multiSelect ),
     171                                me = this;
     172
     173                        panel.onShow = function()
     174                                {
     175                                        if ( me.className )
     176                                                this.element.addClass( me.className );
     177
     178                                        me.document.getById( 'cke_' + me.id ).addClass( 'cke_on');
     179
     180                                        me._.on = 1;
     181
     182                                        if ( me.onOpen )
     183                                                me.onOpen();
     184                                };
     185
     186                        panel.onHide = function()
     187                                {
     188                                        if ( me.className )
     189                                                this.element.removeClass( me.className );
     190
     191                                        me.document.getById( 'cke_' + me.id ).removeClass( 'cke_on');
     192
     193                                        me._.on = 0;
     194
     195                                        if ( me.onClose )
     196                                                me.onClose();
     197                                };
     198
     199                        list.onClick = function( value, marked )
     200                                {
     201                                        if ( marked )
     202                                                me.setValue( value, me._.items[ value ] );
     203                                        else
     204                                                me.setValue( '' );
     205
     206                                        // Move the focus to the main windows, otherwise it will stay
     207                                        // into the floating panel, even if invisible, and Safari and
     208                                        // Opera will go a bit crazy.
     209                                        me.document.getWindow().focus();
     210
     211                                        if ( me.onClick )
     212                                                me.onClick.call( me, value, marked );
     213
     214                                        panel.hide();
     215                                };
     216
     217                        this._.panel = panel;
     218                        this._.list = list;
     219
     220                        if ( this.init )
     221                                this.init();
     222                },
     223
     224                setValue : function( value, text )
     225                {
     226                        this._.value = value;
     227
     228                        var textElement = this.document.getById( 'cke_' + this.id + '_text' );
     229                        textElement.setHtml( typeof text != 'undefined' ? text : value );
     230                },
     231
     232                getValue : function()
     233                {
     234                        return this._.value || '';
     235                },
     236
     237                add : function( value, html, text )
     238                {
     239                        this._.items[ value ] = text || value;
     240                        this._.list.add( value, html );
     241                },
     242
     243                startGroup : function( title )
     244                {
     245                        this._.list.startGroup( title );
     246                }
     247        }
     248});
     249
     250CKEDITOR.ui.prototype.addRichCombo = function( name, definition )
     251{
     252        this.add( name, CKEDITOR.UI_RICHCOMBO, definition );
     253};
  • _source/plugins/styles/plugin.js

     
    177177                checkElementRemovable : function( element, fullMatch )
    178178                {
    179179                        if ( !element || element.getName() != this.element )
    180                                 return false ;
     180                                return false;
    181181
    182182                        var def = this._.definition;
    183183                        var attribs = def.attributes;
     
    185185
    186186                        // If no attributes are defined in the element.
    187187                        if ( !fullMatch && !element.hasAttributes() )
    188                                 return true ;
     188                                return true;
    189189
    190190                        for ( var attName in attribs )
    191191                        {
     
    525525
    526526        var applyBlockStyle = function( range )
    527527        {
     528                // Bookmark the range so we can re-select it after processing.
     529                var bookmark = range.createBookmark();
     530
     531                var iterator = range.createIterator();
     532                iterator.enforceRealBlocks = true;
     533
     534                var block;
     535                var doc = range.document;
     536                var previousPreBlock;
     537
     538                while( ( block = iterator.getNextParagraph() ) )                // Only one =
     539                {
     540                        // Create the new node right before the current one.
     541                        var newBlock = getElement( this, doc );
     542
     543                        // Check if we are changing from/to <pre>.
     544//                      var newBlockIsPre       = newBlock.nodeName.IEquals( 'pre' );
     545//                      var blockIsPre          = block.nodeName.IEquals( 'pre' );
     546
     547//                      var toPre       = newBlockIsPre && !blockIsPre;
     548//                      var fromPre     = !newBlockIsPre && blockIsPre;
     549
     550                        // Move everything from the current node to the new one.
     551//                      if ( toPre )
     552//                              newBlock = this._ToPre( doc, block, newBlock );
     553//                      else if ( fromPre )
     554//                              newBlock = this._FromPre( doc, block, newBlock );
     555//                      else    // Convering from a regular block to another regular block.
     556                                block.moveChildren( newBlock );
     557
     558                        // Replace the current block.
     559                        newBlock.insertBefore( block );
     560                        block.remove();
     561
     562                        // Complete other tasks after inserting the node in the DOM.
     563//                      if ( newBlockIsPre )
     564//                      {
     565//                              if ( previousPreBlock )
     566//                                      this._CheckAndMergePre( previousPreBlock, newBlock ) ;  // Merge successive <pre> blocks.
     567//                              previousPreBlock = newBlock;
     568//                      }
     569//                      else if ( fromPre )
     570//                              this._CheckAndSplitPre( newBlock ) ;    // Split <br><br> in successive <pre>s.
     571                }
     572
     573                range.moveToBookmark( bookmark );
    528574        };
    529575
    530576        // Removes a style from an element itself, don't care about its subtree.
  • _source/plugins/toolbar/plugin.js

     
    134134                                                                if ( itemName == '-' )
    135135                                                                        item = CKEDITOR.ui.separator;
    136136                                                                else
    137                                                                         item = editor.ui.get( itemName );
     137                                                                        item = editor.ui.create( itemName );
    138138
    139139                                                                if ( item )
    140140                                                                {
     
    220220                'Link', 'Unlink', 'Anchor', '-',
    221221                'Image', 'Flash', '-',
    222222                'Table', 'Smiley', 'HorizontalRule', 'SpecialChar', 'PageBreak', '-',
    223                 'ShowBlocks'
     223                'ShowBlocks', '-',
     224                'Format'
    224225        ]
    225226];
  • _source/skins/default/editor.css

     
    66@import url("reset.css");
    77@import url("mainui.css");
    88@import url("toolbar.css");
     9@import url("panel.css");
     10@import url("richcombo.css");
    911@import url("elementspath.css");
    1012
    1113/* Restore the container visibility */
  • _source/skins/default/panel.css

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6.cke_skin_default.cke_panel
     7{
     8        border: 1px solid #316ac5;
     9        background-color: #fff;
     10
     11        width: 120px;
     12        height: 100px;
     13
     14        overflow:hidden;
     15
     16        -moz-border-radius-bottomright: 3px;
     17        -webkit-border-bottom-right-radius: 3px;
     18        border-bottom-left-radius: 3px;
     19        -moz-border-radius-bottomleft: 3px;
     20        -webkit-border-bottom-left-radius: 3px;
     21        border-bottom-left-radius: 3px;
     22        -moz-border-radius-topright: 3px;
     23        -webkit-border-top-right-radius: 3px;
     24        border-top-right-radius: 3px;
     25}
     26
     27.cke_skin_default.cke_panel.cke_format
     28{
     29        width: 150px;
     30        height: 170px;
     31}
     32
     33/* Ideally we would use "inherit here"... but you know... IE :( */
     34.cke_skin_default.cke_panel iframe
     35{
     36        width: 100%;
     37        height: 100%;
     38}
     39
     40/*
     41 * All the following styles are to be used inside the iframe that holds panel
     42 * contents. We don't use the cke_skin_default there to avoid the reset to be
     43 * active.
     44 * This is not an issue as we'll never have two skins running inside the same
     45 * panel iframe.
     46 */
     47
     48body.cke_panel_frame
     49{
     50        overflow: auto;
     51        overflow-x: hidden;
     52}
     53
     54ul.cke_panel_list
     55{
     56        list-style-type: none;
     57        margin: 3px;
     58        padding: 0px;
     59    white-space: nowrap;
     60}
     61
     62li.cke_panel_listItem
     63{
     64        margin: 0px;
     65}
     66
     67.cke_panel_listItem a
     68{
     69        padding: 2px;
     70        display: block;
     71        border: 1px solid #fff;
     72        color: inherit;
     73        text-decoration: none;
     74        overflow: hidden;
     75    text-overflow: ellipsis;
     76}
     77
     78/* IE6 */
     79* html .cke_panel_listItem a
     80{
     81        width : 100%;
     82
     83        /* IE is not able to inherit the color, so we must force it to black */
     84        color: #000;
     85}
     86
     87/* IE7 */
     88*:first-child+html .cke_panel_listItem a
     89{
     90        /* IE is not able to inherit the color, so we must force it to black */
     91        color: #000;
     92}
     93
     94.cke_panel_listItem.cke_selected a
     95{
     96        border: 1px solid #ccc;
     97        background-color: #e9f5ff;
     98}
     99
     100.cke_panel_listItem a:hover,
     101.cke_panel_listItem a:focus,
     102.cke_panel_listItem a:active
     103{
     104        border-color: #316ac5;
     105        background-color: #dff1ff;
     106}
     107
     108.cke_panel_grouptitle
     109{
     110    font-size: 11px;
     111    font-family: 'Microsoft Sans Serif' , Tahoma, Arial, Verdana, Sans-Serif;
     112        font-weight: bold;
     113    white-space: nowrap;
     114        background-color: #dcdcdc;
     115        color: #000;
     116        margin:0px;
     117        padding:3px;
     118}
     119
     120.cke_panel_listItem p,
     121.cke_panel_listItem h1,
     122.cke_panel_listItem h2,
     123.cke_panel_listItem h3,
     124.cke_panel_listItem h4,
     125.cke_panel_listItem h5,
     126.cke_panel_listItem h6,
     127.cke_panel_listItem pre
     128{
     129        margin-top: 3px;
     130        margin-bottom: 3px;
     131}
     132/*
     133Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     134For licensing, see LICENSE.html or http://ckeditor.com/license
     135*/
     136
     137.cke_skin_default.cke_panel
     138{
     139        border: 1px solid #316ac5;
     140        background-color: #fff;
     141
     142        width: 120px;
     143        height: 100px;
     144
     145        overflow:hidden;
     146
     147        -moz-border-radius-bottomright: 3px;
     148        -webkit-border-bottom-right-radius: 3px;
     149        border-bottom-left-radius: 3px;
     150        -moz-border-radius-bottomleft: 3px;
     151        -webkit-border-bottom-left-radius: 3px;
     152        border-bottom-left-radius: 3px;
     153        -moz-border-radius-topright: 3px;
     154        -webkit-border-top-right-radius: 3px;
     155        border-top-right-radius: 3px;
     156}
     157
     158.cke_skin_default.cke_panel.cke_format
     159{
     160        width: 150px;
     161        height: 170px;
     162}
     163
     164/* Ideally we would use "inherit here"... but you know... IE :( */
     165.cke_skin_default.cke_panel iframe
     166{
     167        width: 100%;
     168        height: 100%;
     169}
     170
     171/*
     172 * All the following styles are to be used inside the iframe that holds panel
     173 * contents. We don't use the cke_skin_default there to avoid the reset to be
     174 * active.
     175 * This is not an issue as we'll never have two skins running inside the same
     176 * panel iframe.
     177 */
     178
     179body.cke_panel_frame
     180{
     181        overflow: auto;
     182        overflow-x: hidden;
     183}
     184
     185ul.cke_panel_list
     186{
     187        list-style-type: none;
     188        margin: 3px;
     189        padding: 0px;
     190    white-space: nowrap;
     191}
     192
     193li.cke_panel_listItem
     194{
     195        margin: 0px;
     196}
     197
     198.cke_panel_listItem a
     199{
     200        padding: 2px;
     201        display: block;
     202        border: 1px solid #fff;
     203        color: inherit;
     204        text-decoration: none;
     205        overflow: hidden;
     206    text-overflow: ellipsis;
     207}
     208
     209/* IE6 */
     210* html .cke_panel_listItem a
     211{
     212        width : 100%;
     213
     214        /* IE is not able to inherit the color, so we must force it to black */
     215        color: #000;
     216}
     217
     218/* IE7 */
     219*:first-child+html .cke_panel_listItem a
     220{
     221        /* IE is not able to inherit the color, so we must force it to black */
     222        color: #000;
     223}
     224
     225.cke_panel_listItem.cke_selected a
     226{
     227        border: 1px solid #ccc;
     228        background-color: #e9f5ff;
     229}
     230
     231.cke_panel_listItem a:hover,
     232.cke_panel_listItem a:focus,
     233.cke_panel_listItem a:active
     234{
     235        border-color: #316ac5;
     236        background-color: #dff1ff;
     237}
     238
     239.cke_panel_grouptitle
     240{
     241    font-size: 11px;
     242    font-family: 'Microsoft Sans Serif' , Tahoma, Arial, Verdana, Sans-Serif;
     243        font-weight: bold;
     244    white-space: nowrap;
     245        background-color: #dcdcdc;
     246        color: #000;
     247        margin:0px;
     248        padding:3px;
     249}
     250
     251.cke_panel_listItem p,
     252.cke_panel_listItem h1,
     253.cke_panel_listItem h2,
     254.cke_panel_listItem h3,
     255.cke_panel_listItem h4,
     256.cke_panel_listItem h5,
     257.cke_panel_listItem h6,
     258.cke_panel_listItem pre
     259{
     260        margin-top: 3px;
     261        margin-bottom: 3px;
     262}
  • _source/skins/default/richcombo.css

     
     1/* Special Combo */
     2
     3.cke_skin_default .cke_rcombo
     4{
     5        padding-right: 4px;
     6        float: left;
     7}
     8
     9/* IE6 only */
     10/*\*/
     11* html .cke_skin_default .cke_rcombo
     12{
     13        float: none;
     14}
     15/**/
     16
     17.cke_skin_default .cke_rcombo a
     18{
     19        filter: alpha(opacity=70); /* IE */
     20        opacity: 0.70; /* Safari, Opera and Mozilla */
     21}
     22
     23.cke_skin_default .cke_rcombo .cke_label
     24{
     25        padding-top: 6px;
     26        padding-left: 4px;
     27        padding-right: 5px;
     28        float: left;
     29        filter: alpha(opacity=70); /* IE */
     30        opacity: 0.70; /* Safari, Opera and Mozilla */
     31        background-color: #f1f1e3;      /* Because of IE6+ClearType */
     32}
     33
     34.cke_skin_default .cke_rcombo .cke_text
     35{
     36        border: 1px solid #8f8f73;
     37        background-color: #fff;
     38        float: left;
     39        height: 14px;
     40        width:60px;
     41        padding-top: 4px;
     42        padding-bottom: 4px;
     43        padding-left: 5px;
     44        padding-right: 5px;
     45    text-overflow: ellipsis;
     46    overflow: hidden;
     47        -moz-border-radius-topleft: 3px;
     48        -webkit-border-top-left-radius: 3px;
     49        border-top-left-radius: 3px;
     50        -moz-border-radius-bottomleft: 3px;
     51        -webkit-border-bottom-left-radius: 3px;
     52        border-bottom-left-radius: 3px;
     53}
     54
     55.cke_skin_default .cke_rcombo .cke_openbutton
     56{
     57    background-position: center center;
     58    background-image: url(images/toolbar.buttonarrow.gif);
     59    border-right: 1px solid #8f8f73;
     60    border-top: 1px solid #8f8f73;
     61    border-bottom: 1px solid #8f8f73;
     62        display: block;
     63        float: left;
     64    width: 14px;
     65        height: 22px;
     66    background-repeat: no-repeat;
     67        -moz-border-radius-topright: 3px;
     68        -webkit-border-top-right-radius: 3px;
     69        border-top-left-radius: 3px;
     70        -moz-border-radius-bottomright: 3px;
     71        -webkit-border-bottom-right-radius: 3px;
     72        border-bottom-left-radius: 3px;
     73}
     74
     75.cke_skin_default .cke_rcombo a:hover,
     76.cke_skin_default .cke_rcombo a:focus,
     77.cke_skin_default .cke_rcombo a:active,
     78.cke_skin_default .cke_rcombo.cke_on a
     79{
     80        filter: alpha(opacity=100); /* IE */
     81        opacity: 1; /* Safari, Opera and Mozilla */
     82}
     83
     84.cke_skin_default .cke_rcombo a:hover .cke_text,
     85.cke_skin_default .cke_rcombo a:focus .cke_text,
     86.cke_skin_default .cke_rcombo a:active .cke_text,
     87.cke_skin_default .cke_rcombo.cke_on .cke_text
     88{
     89        border-color: #316ac5;
     90}
     91
     92.cke_skin_default .cke_rcombo a:hover .cke_openbutton,
     93.cke_skin_default .cke_rcombo a:focus .cke_openbutton,
     94.cke_skin_default .cke_rcombo a:active .cke_openbutton,
     95.cke_skin_default .cke_rcombo.cke_on .cke_openbutton
     96{
     97        border-color: #316ac5;
     98        background-color: #dff1ff;
     99}
     100
     101.cke_skin_default .cke_rcombo.cke_on .cke_text
     102{
     103        -moz-border-radius-bottomleft: 0px;
     104        -webkit-border-bottom-left-radius: 0px;
     105        border-bottom-left-radius: 0px;
     106}
     107
     108.cke_skin_default .cke_rcombo.cke_on .cke_openbutton
     109{
     110        -moz-border-radius-bottomright: 0px;
     111        -webkit-border-bottom-right-radius: 0px;
     112        border-bottom-right-radius: 0px;
     113}
     114/* Special Combo */
     115
     116.cke_skin_default .cke_rcombo
     117{
     118        padding-right: 4px;
     119        float: left;
     120}
     121
     122/* IE6 only */
     123/*\*/
     124* html .cke_skin_default .cke_rcombo
     125{
     126        float: none;
     127}
     128/**/
     129
     130.cke_skin_default .cke_rcombo a
     131{
     132        filter: alpha(opacity=70); /* IE */
     133        opacity: 0.70; /* Safari, Opera and Mozilla */
     134}
     135
     136.cke_skin_default .cke_rcombo .cke_label
     137{
     138        padding-top: 6px;
     139        padding-left: 4px;
     140        padding-right: 5px;
     141        float: left;
     142        filter: alpha(opacity=70); /* IE */
     143        opacity: 0.70; /* Safari, Opera and Mozilla */
     144        background-color: #f1f1e3;      /* Because of IE6+ClearType */
     145}
     146
     147.cke_skin_default .cke_rcombo .cke_text
     148{
     149        border: 1px solid #8f8f73;
     150        background-color: #fff;
     151        float: left;
     152        height: 14px;
     153        width:60px;
     154        padding-top: 4px;
     155        padding-bottom: 4px;
     156        padding-left: 5px;
     157        padding-right: 5px;
     158    text-overflow: ellipsis;
     159    overflow: hidden;
     160        -moz-border-radius-topleft: 3px;
     161        -webkit-border-top-left-radius: 3px;
     162        border-top-left-radius: 3px;
     163        -moz-border-radius-bottomleft: 3px;
     164        -webkit-border-bottom-left-radius: 3px;
     165        border-bottom-left-radius: 3px;
     166}
     167
     168.cke_skin_default .cke_rcombo .cke_openbutton
     169{
     170    background-position: center center;
     171    background-image: url(images/toolbar.buttonarrow.gif);
     172    border-right: 1px solid #8f8f73;
     173    border-top: 1px solid #8f8f73;
     174    border-bottom: 1px solid #8f8f73;
     175        display: block;
     176        float: left;
     177    width: 14px;
     178        height: 22px;
     179    background-repeat: no-repeat;
     180        -moz-border-radius-topright: 3px;
     181        -webkit-border-top-right-radius: 3px;
     182        border-top-left-radius: 3px;
     183        -moz-border-radius-bottomright: 3px;
     184        -webkit-border-bottom-right-radius: 3px;
     185        border-bottom-left-radius: 3px;
     186}
     187
     188.cke_skin_default .cke_rcombo a:hover,
     189.cke_skin_default .cke_rcombo a:focus,
     190.cke_skin_default .cke_rcombo a:active,
     191.cke_skin_default .cke_rcombo.cke_on a
     192{
     193        filter: alpha(opacity=100); /* IE */
     194        opacity: 1; /* Safari, Opera and Mozilla */
     195}
     196
     197.cke_skin_default .cke_rcombo a:hover .cke_text,
     198.cke_skin_default .cke_rcombo a:focus .cke_text,
     199.cke_skin_default .cke_rcombo a:active .cke_text,
     200.cke_skin_default .cke_rcombo.cke_on .cke_text
     201{
     202        border-color: #316ac5;
     203}
     204
     205.cke_skin_default .cke_rcombo a:hover .cke_openbutton,
     206.cke_skin_default .cke_rcombo a:focus .cke_openbutton,
     207.cke_skin_default .cke_rcombo a:active .cke_openbutton,
     208.cke_skin_default .cke_rcombo.cke_on .cke_openbutton
     209{
     210        border-color: #316ac5;
     211        background-color: #dff1ff;
     212}
     213
     214.cke_skin_default .cke_rcombo.cke_on .cke_text
     215{
     216        -moz-border-radius-bottomleft: 0px;
     217        -webkit-border-bottom-left-radius: 0px;
     218        border-bottom-left-radius: 0px;
     219}
     220
     221.cke_skin_default .cke_rcombo.cke_on .cke_openbutton
     222{
     223        -moz-border-radius-bottomright: 0px;
     224        -webkit-border-bottom-right-radius: 0px;
     225        border-bottom-right-radius: 0px;
     226}
  • _source/tests/core/event.html

     
    449449                        assert.areSame( false, isCanceledC, 'event C must not be canceled' );
    450450                },
    451451
     452                test_event_removeListener : function()
     453                {
     454                        // Create a testObject and implement CKEDITOR.event on it.
     455                        var testObject = {};
     456                        CKEDITOR.event.implementOn( testObject );
     457
     458                        var counter = 0;
     459
     460                        // Add two listeners for the same event "A".
     461
     462                        testObject.on( 'A', function( ev )
     463                                {
     464                                        counter++;
     465                                        ev.removeListener();
     466                                });
     467
     468                        testObject.on( 'A', function( ev )
     469                                {
     470                                        counter++;
     471                                });
     472
     473                        // Fire the event twice.
     474                        testObject.fire( 'A' );
     475                        testObject.fire( 'A' );
     476
     477                        assert.areSame( 3, counter );
     478                },
     479
    452480                name : document.title
    453481        };
    454482})() );
  • _source/themes/default/theme.js

     
    5757                        // differently by the browsers ("semi-inline").
    5858                        var container = CKEDITOR.dom.element.createFromHtml( [
    5959                                '<span id="cke_', name, '" onmousedown="return false;" class="cke_container cke_skin_', editor.config.skin, ' ', browserCssClass,
    60                                         ' cke_', editor.lang.dir, '" dir="', editor.lang.dir, '">' +
     60                                        ' cke_', editor.lang.dir, '" dir="', editor.lang.dir, '" title="', ( CKEDITOR.env.gecko ? ' ' : '' ), '">' +
    6161                                        '<table class="cke_editor" border="0" cellspacing="0" cellpadding="0" style="width:', width, ';height:', height, '"><tbody>' +
    6262                                                '<tr', topHtml          ? '' : ' style="display:none"', '><td id="cke_top_'             , name, '" class="cke_top">'            , topHtml               , '</td></tr>' +
    6363                                                '<tr', contentsHtml     ? '' : ' style="display:none"', '><td id="cke_contents_', name, '" class="cke_contents" style="height:100%">'   , contentsHtml  , '</td></tr>' +
  • ckeditor.pack

     
    4646                'CKEDITOR.SELECTION_NONE' : 1,
    4747                'CKEDITOR.SELECTION_TEXT' : 2,
    4848                'CKEDITOR.SELECTION_ELEMENT' : 3,
     49                'CKEDITOR.UI_RICHCOMBO' : 3,
    4950                'CKEDITOR.DIALOG_RESIZE_NONE' : 0,
    5051                'CKEDITOR.DIALOG_RESIZE_WIDTH' : 1,
    5152                'CKEDITOR.DIALOG_RESIZE_HEIGHT' : 2,
    5253                'CKEDITOR.DIALOG_RESIZE_BOTH' : 3,
    5354                'CKEDITOR.VALIDATE_OR' : 1,
    54                 'CKEDITOR.VALIDATE_AND' : 2
     55                'CKEDITOR.VALIDATE_AND' : 2,
     56                'CKEDITOR.UI_PANEL' : 2
    5557        },
    5658
    5759packages :
     
    120122                                        '_source/plugins/clipboard/plugin.js',
    121123                                        '_source/plugins/elementspath/plugin.js',
    122124                                        '_source/plugins/find/plugin.js',
     125                                        '_source/plugins/flash/plugin.js',
     126                                        '_source/plugins/format/plugin.js',
    123127                                        '_source/plugins/horizontalrule/plugin.js',
    124128                                        '_source/plugins/htmldataprocessor/plugin.js',
    125129                                        '_source/plugins/image/plugin.js',
     
    136140                                        '_source/plugins/print/plugin.js',
    137141                                        '_source/plugins/removeformat/plugin.js',
    138142                                        '_source/plugins/smiley/plugin.js',
     143                                        '_source/plugins/showblocks/plugin.js',
    139144                                        '_source/plugins/sourcearea/plugin.js',
    140145                                        '_source/plugins/table/plugin.js',
    141146                                        '_source/plugins/specialchar/plugin.js',
     
    147152                                        '_source/plugins/styles/plugin.js',
    148153                                        '_source/plugins/domiterator/plugin.js',
    149154                                        '_source/plugins/selection/plugin.js',
     155                                        '_source/plugins/fakeobjects/plugin.js',
     156                                        '_source/plugins/richcombo/plugin.js',
    150157                                        '_source/plugins/htmlwriter/plugin.js',
    151                                         '_source/plugins/fakeobjects/plugin.js',
    152158                                        '_source/plugins/dialog/plugin.js',
    153159                                        '_source/plugins/editingblock/plugin.js',
     160                                        '_source/plugins/floatpanel/plugin.js',
     161                                        '_source/plugins/listblock/plugin.js',
    154162                                        '_source/plugins/dialogui/plugin.js',
     163                                        '_source/plugins/panel/plugin.js',
    155164                                        '_source/skins/default/skin.js',
    156165                                        '_source/themes/default/theme.js'
    157166                                ]
  • contents.css

     
    99        font-family: Arial, Verdana, sans-serif;
    1010        font-size: 12px;
    1111
     12        /* Text color */
     13        color: #222;
     14
    1215        /* Remove the background color to make it transparent */
    1316        background-color: #fff;
    1417}
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy