Ticket #635: 635_4.patch

File 635_4.patch, 2.1 KB (added by Minh Nguyen, 14 years ago)

New patch with simple detection

  • _source/plugins/wysiwygarea/plugin.js

     
    244244                                body.append( editor.document.createText( '\xa0' ) );
    245245                }
    246246        }
     247       
     248        function getRealElement( element )
     249        {
     250                var name = element.getName(),
     251                        realElement = element.getAttribute( '_cke_real_element_type' );
     252                switch ( name )
     253                {
     254                        case 'img':
     255                                return realElement ? realElement : 'image';
     256                        case 'a':
     257                                return ( element.getAttribute( 'name' ) && !element.getAttribute( 'href' ) ) ? 'anchor' : 'link';
     258                        case 'input':
     259                                var type = element.getAttribute( 'type' );
    247260
     261                                if ( type == 'button' || type == 'submit' || type == 'reset' )
     262                                        return 'button';
     263                                       
     264                                if ( type == 'text' || type == 'password' )
     265                                        return 'textfield';
     266
     267                                if ( type == 'checkbox' )
     268                                        return 'checkbox';
     269
     270                                if ( type == 'radio' )
     271                                        return 'radio';
     272
     273                                if ( type == 'image' )
     274                                        return 'imagebutton';
     275                        case 'td':
     276                                return 'cellProperties';
     277                        default:
     278                                return name;
     279                }
     280               
     281        }
     282       
    248283        CKEDITOR.plugins.add( 'wysiwygarea',
    249284        {
    250285                requires : [ 'editingblock' ],
     
    369404                                                domWindow       = editor.window         = new CKEDITOR.dom.window( domWindow );
    370405                                                domDocument     = editor.document       = new CKEDITOR.dom.document( domDocument );
    371406
     407                                                domDocument.on( 'dblclick', function(ev)
     408                                                {
     409                                                       
     410                                                        var element = ev.data.getTarget(),
     411                                                                dialogName = getRealElement( element ),
     412                                                                dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions;
     413                                                       
     414                                                        dialogName && (dialogName in dialogDefinitions) && editor.openDialog( dialogName );
     415                                                } );
     416                                               
    372417                                                // Gecko/Webkit need some help when selecting control type elements. (#3448)
    373418                                                if ( !( CKEDITOR.env.ie || CKEDITOR.env.opera) )
    374419                                                {
     
    781826                                        ieFocusGrabber.clearCustomData();
    782827                                } );
    783828                        }
     829                },
     830                getRealElement: function( element )
     831                {
     832                        alert( 'xong' );
    784833                }
    785834        });
    786835
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy