Вход Регистрация
Файл: public/js/3rd_party/ckeditor/plugins/forms/dialogs/button.js
Строк: 118
<?php

/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add'button', function( editor )
{
    function 
commitAttributeselement )
    {
        var 
val this.getValue();
        if ( 
val )
        {
            
element.attributesthis.id ] = val;
            if ( 
this.id == 'name' )
                
element.attributes'data-cke-saved-name' ] = val;
        }
        else
        {
            
delete element.attributesthis.id ];
            if ( 
this.id == 'name' )
                
delete element.attributes'data-cke-saved-name' ];
        }
    }

    return {
        
title editor.lang.button.title,
        
minWidth 350,
        
minHeight 150,
        
onShow : function()
        {
            
delete this.button;
            var 
element this.getParentEditor().getSelection().getSelectedElement();
            if ( 
element && element.is'input' ) )
            {
                var 
type element.getAttribute'type' );
                if ( 
type in button:1reset:1submit:} )
                {
                    
this.button element;
                    
this.setupContentelement );
                }
            }
        },
        
onOk : function()
        {
            var 
editor this.getParentEditor(),
                
element this.button,
                
isInsertMode = !element;

            var 
fake element CKEDITOR.htmlParser.fragment.fromHtmlelement.getOuterHtml() ).children]
                    : new 
CKEDITOR.htmlParser.element'input' );
            
this.commitContentfake );

            var 
writer = new CKEDITOR.htmlParser.basicWriter();
            
fake.writeHtmlwriter );
            var 
newElement CKEDITOR.dom.element.createFromHtmlwriter.getHtml(), editor.document );

            if ( 
isInsertMode )
                
editor.insertElementnewElement );
            else
            {
                
newElement.replaceelement );
                
editor.getSelection().selectElementnewElement );
            }
        },
        
contents : [
            {
                
id 'info',
                
label editor.lang.button.title,
                
title editor.lang.button.title,
                
elements : [
                    {
                        
id 'name',
                        
type 'text',
                        
label editor.lang.common.name,
                        
'default' '',
                        
setup : function( element )
                        {
                            
this.setValue(
                                    
element.data'cke-saved-name' ) ||
                                    
element.getAttribute'name' ) ||
                                    
'' );
                        },
                        
commit commitAttributes
                    
},
                    {
                        
id 'value',
                        
type 'text',
                        
label editor.lang.button.text,
                        
accessKey 'V',
                        
'default' '',
                        
setup : function( element )
                        {
                            
this.setValueelement.getAttribute'value' ) || '' );
                        },
                        
commit commitAttributes
                    
},
                    {
                        
id 'type',
                        
type 'select',
                        
label editor.lang.button.type,
                        
'default' 'button',
                        
accessKey 'T',
                        
items :
                        [
                            [ 
editor.lang.button.typeBtn'button' ],
                            [ 
editor.lang.button.typeSbm'submit' ],
                            [ 
editor.lang.button.typeRst'reset' ]
                        ],
                        
setup : function( element )
                        {
                            
this.setValueelement.getAttribute'type' ) || '' );
                        },
                        
commit commitAttributes
                    
}
                ]
            }
        ]
    };
});
?>
Онлайн: 0
Реклама