Ticket #4252: 4252_2.patch

File 4252_2.patch, 9.2 KB (added by Garry Yao, 15 years ago)
  • _source/core/ui.js

     
    7575                if ( command )
    7676                        command.uiItems.push( result );
    7777
     78                // Replace the registered items with created instances.
     79                this._.items[ name ] = result;
     80
    7881                return result;
    7982        },
    8083
  • _source/plugins/richcombo/plugin.js

     
    273273                                        me.setState( CKEDITOR.TRISTATE_OFF );
    274274                                };
    275275
     276                        panel.on( 'showBlock', function()
     277                        {
     278                                this.fire( 'open', panel );
     279                        }, this );
     280
    276281                        if ( this.init )
    277282                                this.init();
    278283                },
     
    351356        }
    352357});
    353358
     359CKEDITOR.event.implementOn( CKEDITOR.ui.richCombo.prototype, true );
    354360CKEDITOR.ui.prototype.addRichCombo = function( name, definition )
    355361{
    356362        this.add( name, CKEDITOR.UI_RICHCOMBO, definition );
  • _source/plugins/menu/plugin.js

     
    151151                                        },
    152152                                        this );
    153153
     154                                        panel.on( 'showBlock', function()
     155                                        {
     156                                                this.fire( 'open', panel );
     157                                        }, this );
     158
     159
    154160                                        // Create an autosize block inside the panel.
    155161                                        var block = panel.addBlock( this.id );
    156162                                        block.autoSize = true;
     
    241247                }
    242248        });
    243249
     250        CKEDITOR.event.implementOn( CKEDITOR.menu.prototype, true );
     251
    244252        function sortItems( items )
    245253        {
    246254                items.sort( function( itemA, itemB )
  • _source/plugins/floatpanel/plugin.js

     
    217217                                                        if ( panel.isLoaded )
    218218                                                                setHeight();
    219219                                                        else
    220                                                                 panel.onLoad = setHeight;
     220                                                                panel.on( 'load', setHeight );
    221221                                                }
    222222                                                else
    223                                                         element.getFirst().removeStyle( 'height' );
     223                                                        element.getFirst().removeStyle('height');
    224224
     225                                                panel.isLoaded ?
     226                                                        this.fire( 'showBlock', block )
     227                                                        : panel.on( 'load', function( evt )
     228                                                          {
     229                                                                  evt.removeListener();
     230                                                                  this.fire( 'showBlock', block );
     231                                                          }, this );
     232
    225233                                                // Set the IFrame focus, so the blur event gets fired.
    226234                                                CKEDITOR.tools.setTimeout( function()
    227235                                                        {
     
    322330                        }
    323331                }
    324332        });
     333
     334        CKEDITOR.event.implementOn( CKEDITOR.ui.floatPanel.prototype, true );
     335
    325336})();
  • _source/plugins/dialog/plugin.js

     
    26802680                                var storedDialogs = this._.storedDialogs ||
    26812681                                        ( this._.storedDialogs = {} );
    26822682
    2683                                 var dialog = storedDialogs[ dialogName ] ||
    2684                                         ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );
    2685 
     2683                                var dialog = storedDialogs[ dialogName ];
     2684                                if( !dialog )
     2685                                {
     2686                                        dialog = ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );
     2687                                        dialog.on( 'show', function()
     2688                                        {
     2689                                                this.fire( 'dialogOpen', dialog );
     2690                                        }, this );
     2691                                }
    26862692                                dialog.show();
    26872693
    26882694                                return dialog;
  • _source/plugins/toolbar/plugin.js

     
    193193                                                                        }
    194194
    195195                                                                        var itemObj = item.render( editor, output );
     196                                                                        item.toolbarItem = itemObj;
    196197                                                                        index = toolbarObj.items.push( itemObj ) - 1;
    197198
    198199                                                                        if ( index > 0 )
  • _source/plugins/panelbutton/plugin.js

     
    133133                                                                _.on = 0;
    134134                                                                me.setState( CKEDITOR.TRISTATE_OFF );
    135135                                                };
     136                                panel.on( 'showBlock', function()
     137                                {
     138                                        this.fire( 'open', panel );
     139                                }, this );
    136140                        }
    137141                }
    138142        });
    139143
     144        CKEDITOR.event.implementOn( CKEDITOR.ui.panelButton.prototype, true );
     145
    140146})();
  • _source/core/test.js

     
    1111
    1212CKEDITOR.test =
    1313{
     14        toolbar :
     15        {
     16                /**
     17                 * Click on a specific toolbar button and the {@param callback} will be
     18                 * fed with the consequential UI object which has been opened by this click.
     19                 *
     20                 * @param itemName The toolbar item definition name.
     21                 * @callback The callback function which is called after the affiliate
     22                 * button behavior has completed.
     23                 * @example
     24                 *
     25                 * // Click on 'Format' combo.
     26                 * CKEDITOR.test.toolbar.clickButton( 'Format' ,
     27                 * function( combo )
     28                 * {
     29                 *      alert( combo instanceof CKEDITOR.ui.richCombo );        // true
     30                 * });
     31                 *
     32                 * // Click on 'Image' dialog.
     33                 * CKEDITOR.test.toolbar.clickButton( 'Image' ,
     34                 * function( dialog )
     35                 * {
     36                 *      alert( dialog instanceof CKEDITOR.dialog );     // true
     37                 * });
     38                 */
     39                clickButton : function( editor, itemName, callback, context )
     40                {
     41                        var ui = editor.ui,
     42                                // Find the corresponding ui instances of the toolbar item.
     43                                uiItems = ui._.items,
     44                                uiItem =uiItems[ itemName ],
     45                                // Back reference the toolbar item instance.
     46                                toolbarItem = uiItem.toolbarItem,
     47                                // Find the command instance registered on this ui item.
     48                                command = editor.getCommand( uiItem.command );
     49
     50                        // Special treatments for different types of button.
     51                        if( uiItem instanceof CKEDITOR.ui.button )
     52                        {
     53                                // button of style command.
     54                                if( command && command.style )
     55                                {
     56                                        editor.on( 'selectionChange', function( evt )
     57                                        {
     58                                                evt.removeListener();
     59                                                callback.call( context );
     60                                        }, null, null, 1000 );
     61                                }
     62                                // button of dialog command.
     63                                if( command && command.dialogName )
     64                                {
     65                                        editor.on( 'dialogOpen', function( evt )
     66                                        {
     67                                                evt.removeListener();
     68                                                callback.call( context, evt.data );
     69                                        }, null, null, 1000 );
     70                                }
     71                                // button of panel.
     72                                else if( uiItem instanceof CKEDITOR.ui.panelButton )
     73                                {
     74                                        uiItem.on( 'open', function( evt )
     75                                        {
     76                                                evt.removeListener();
     77                                                callback.call( context, uiItem );
     78                                        }, null, 1000 );
     79                                }
     80
     81                                // Trigger button.
     82                                toolbarItem.execute();
     83                        }
     84                        else if( uiItem instanceof CKEDITOR.ui.richCombo )
     85                        {
     86                                uiItem.on( 'open', function( evt )
     87                                {
     88                                        evt.removeListener();
     89                                        callback.call( context, uiItem );
     90                                }, null, 1000 );
     91
     92                                // Trigger combo.
     93                                var comboEntry = YAHOO.util.Selector.query( 'a', toolbarItem.id, true );
     94                                comboEntry.onclick();
     95                        }
     96                }
     97
     98        },
     99
     100        dialog :
     101        {
     102                /**
     103                 * Filling the assigned dialog with a specified set of field values and finally close it.
     104                 * @param dialog {CKEDITOR.dialog} The dialog instance to populate.
     105                 * @param profile {Object} The page - field - value map to be filled into the dialog.
     106                 * @example
     107                 * CKEDITOR.test.dialog.fill( imageDialog,
     108                 *       {
     109                 *               info :
     110                 *               {
     111                 *                        txtUrl : 'http://ckeditor.com/logos.gif'
     112                 *               },
     113                 *               Link :
     114                 *               {
     115                 *                       txtUrl : 'http://ckeditor.com'
     116                 *               },
     117                 *               advanced :
     118                 *               {
     119                 *                       linkId : 'link_id1',
     120                 *                       txtGenClass : 'cls'
     121                 *               }
     122                 *       } );
     123         *
     124                 */
     125                fill : function ( dialog, profile )
     126                {
     127                        var field, page;
     128                        for( var pageName in profile )
     129                        {
     130                                // Activate the page.
     131                                dialog.selectPage( pageName );
     132
     133                                page = profile[ pageName ];
     134                                for( var fieldId in page )
     135                                {
     136                                        field = dialog.getContentElement( pageName, fieldId );
     137                                        // Populate the field.
     138                                        field.setValue( page[ fieldId ] );
     139                                }
     140                        }
     141                        dialog.click( 'ok' );
     142                }
     143
     144        }
    14145};
    15146YAHOO.lang.augmentObject( CKEDITOR.test, CKTESTER.tools );
  • _source/plugins/panel/plugin.js

     
    141141                                if ( CKEDITOR.env.isCustomDomain() )
    142142                                        doc.$.domain = document.domain;
    143143
    144                                 var onLoad = CKEDITOR.tools.addFunction( CKEDITOR.tools.bind( function( ev )
     144                                var onLoad = CKEDITOR.tools.addFunction( CKEDITOR.tools.bind( function()
    145145                                        {
    146146                                                this.isLoaded = true;
    147                                                 if ( this.onLoad )
    148                                                         this.onLoad();
     147                                                this.fire( 'load', this );
     148
    149149                                        }, this ) );
    150150
    151151                                doc.$.write(
     
    233233        }
    234234};
    235235
     236CKEDITOR.event.implementOn( CKEDITOR.ui.panel.prototype, true );
    236237CKEDITOR.ui.panel.block = CKEDITOR.tools.createClass(
    237238{
    238239        $ : function( blockHolder )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy