Ticket #5418: 5418_1.patch

File 5418_1.patch, 5.9 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/plugins/table/dialogs/table.js

     
    1919        function tableDialog( editor, command )
    2020        {
    2121                var makeElement = function( name ){ return new CKEDITOR.dom.element( name, editor.document ); };
    22 
     22               
     23                var advParamsMap = {
     24                        'advLangDir' : 'dir',
     25                        'advAccessKey' : 'accessKey',
     26                        'advName' : 'name',
     27                        'advLangCode' : 'lang',
     28                        'advTabIndex' : 'tabindex',
     29                        'advTitle' : 'title',
     30                        'advContentType' : 'type',
     31                        'advCSSClasses' : 'class',
     32                        'advCharset' : 'charset',
     33                        'advStyles' : 'style',
     34                        'advId' : 'id'
     35                };
     36
     37                var setupAdvParams = function( data )
     38                {
     39                        var attrName = advParamsMap[ this.id ];
     40                        var value = data.hasAttribute( attrName ) && data.getAttribute( attrName );
     41
     42                        // Compatibility with showborders plugin.
     43                        if ( attrName == 'class' )
     44                        {
     45                                var _tmpValue = CKEDITOR.tools.trim( value ).split( ' ' );
     46                                if ( CKEDITOR.tools.indexOf( _tmpValue, 'cke_show_border' ) != -1 )
     47                                {
     48                                        var newValue = [];
     49                                        for ( var i = 0; i < _tmpValue.length; i++ )
     50                                        {
     51                                                if ( _tmpValue[ i ] != 'cke_show_border' )
     52                                                        newValue.push( _tmpValue[ i ] );
     53                                        }
     54                                        value = newValue.length && newValue.join( ' ' ) || undefined;
     55                                }
     56                        }
     57
     58                        if ( value !== undefined )
     59                                this.setValue( value )
     60                };
     61
     62                var commitAdvParams = function( data, element )
     63                {
     64                        var value = this.getValue();
     65                        if ( value )
     66                        {
     67                                var attrName = advParamsMap[ this.id ];
     68
     69                                // Compatibility with showborders plugin.
     70                                if ( attrName == 'class' )
     71                                {
     72                                        if ( CKEDITOR.tools.indexOf( CKEDITOR.tools.trim( element.getAttribute( 'class' ) ).split( ' ' ), 'cke_show_border' ) != -1 )
     73                                                value += ' cke_show_border';
     74                                }
     75                               
     76                                if ( attrName != 'id' || ( attrName == 'id' && this._.selectedElement ) )
     77                                        element.setAttribute( attrName, value );
     78                        }
     79                        else
     80                                element.removeAttribute( attrName, value );
     81                };
     82
    2383                return {
    2484                        title : editor.lang.table.title,
    2585                        minWidth : 310,
     
    580640                                                        ]
    581641                                                }
    582642                                        ]
    583                                 }
    584                         ]
     643                                },
     644                                {
     645                                        id : 'advanced',
     646                                        label : editor.lang.link.advanced,
     647                                        title : editor.lang.link.advanced,
     648                                        elements :
     649                                        [
     650                                                {
     651                                                        type : 'vbox',
     652                                                        padding : 1,
     653                                                        children :
     654                                                        [
     655                                                                {
     656                                                                        type : 'hbox',
     657                                                                        widths : [ '45%', '35%', '20%' ],
     658                                                                        children :
     659                                                                        [
     660                                                                                {
     661                                                                                        type : 'text',
     662                                                                                        id : 'advId',
     663                                                                                        label : editor.lang.link.id,
     664                                                                                        setup : setupAdvParams,
     665                                                                                        commit : commitAdvParams
     666                                                                                },
     667                                                                                {
     668                                                                                        type : 'select',
     669                                                                                        id : 'advLangDir',
     670                                                                                        label : editor.lang.link.langDir,
     671                                                                                        'default' : '',
     672                                                                                        style : 'width:110px',
     673                                                                                        items :
     674                                                                                        [
     675                                                                                                [ editor.lang.common.notSet, '' ],
     676                                                                                                [ editor.lang.link.langDirLTR, 'ltr' ],
     677                                                                                                [ editor.lang.link.langDirRTL, 'rtl' ]
     678                                                                                        ],
     679                                                                                        setup : setupAdvParams,
     680                                                                                        commit : commitAdvParams
     681                                                                                },
     682                                                                                {
     683                                                                                        type : 'text',
     684                                                                                        id : 'advAccessKey',
     685                                                                                        width : '80px',
     686                                                                                        label : editor.lang.link.acccessKey,
     687                                                                                        maxLength : 1,
     688                                                                                        setup : setupAdvParams,
     689                                                                                        commit : commitAdvParams
     690
     691                                                                                }
     692                                                                        ]
     693                                                                },
     694                                                                {
     695                                                                        type : 'hbox',
     696                                                                        widths : [ '45%', '35%', '20%' ],
     697                                                                        children :
     698                                                                        [
     699                                                                                {
     700                                                                                        type : 'text',
     701                                                                                        label : editor.lang.link.name,
     702                                                                                        id : 'advName',
     703                                                                                        setup : setupAdvParams,
     704                                                                                        commit : commitAdvParams
     705
     706                                                                                },
     707                                                                                {
     708                                                                                        type : 'text',
     709                                                                                        label : editor.lang.link.langCode,
     710                                                                                        id : 'advLangCode',
     711                                                                                        width : '110px',
     712                                                                                        'default' : '',
     713                                                                                        setup : setupAdvParams,
     714                                                                                        commit : commitAdvParams
     715
     716                                                                                },
     717                                                                                {
     718                                                                                        type : 'text',
     719                                                                                        label : editor.lang.link.tabIndex,
     720                                                                                        id : 'advTabIndex',
     721                                                                                        width : '80px',
     722                                                                                        maxLength : 5,
     723                                                                                        setup : setupAdvParams,
     724                                                                                        commit : commitAdvParams
     725
     726                                                                                }
     727                                                                        ]
     728                                                                }
     729                                                        ]
     730                                                },
     731                                                {
     732                                                        type : 'vbox',
     733                                                        padding : 1,
     734                                                        children :
     735                                                        [
     736                                                                {
     737                                                                        type : 'hbox',
     738                                                                        widths : [ '45%', '55%' ],
     739                                                                        children :
     740                                                                        [
     741                                                                                {
     742                                                                                        type : 'text',
     743                                                                                        label : editor.lang.link.advisoryTitle,
     744                                                                                        'default' : '',
     745                                                                                        id : 'advTitle',
     746                                                                                        setup : setupAdvParams,
     747                                                                                        commit : commitAdvParams
     748
     749                                                                                },
     750                                                                                {
     751                                                                                        type : 'text',
     752                                                                                        label : editor.lang.link.advisoryContentType,
     753                                                                                        'default' : '',
     754                                                                                        id : 'advContentType',
     755                                                                                        setup : setupAdvParams,
     756                                                                                        commit : commitAdvParams
     757
     758                                                                                }
     759                                                                        ]
     760                                                                },
     761                                                                {
     762                                                                        type : 'hbox',
     763                                                                        widths : [ '45%', '55%' ],
     764                                                                        children :
     765                                                                        [
     766                                                                                {
     767                                                                                        type : 'text',
     768                                                                                        label : editor.lang.link.cssClasses,
     769                                                                                        'default' : '',
     770                                                                                        id : 'advCSSClasses',
     771                                                                                        setup : setupAdvParams,
     772                                                                                        commit : commitAdvParams
     773
     774                                                                                },
     775                                                                                {
     776                                                                                        type : 'text',
     777                                                                                        label : editor.lang.link.charset,
     778                                                                                        'default' : '',
     779                                                                                        id : 'advCharset',
     780                                                                                        setup : setupAdvParams,
     781                                                                                        commit : commitAdvParams
     782
     783                                                                                }
     784                                                                        ]
     785                                                                },
     786                                                                {
     787                                                                        type : 'hbox',
     788                                                                        children :
     789                                                                        [
     790                                                                                {
     791                                                                                        type : 'text',
     792                                                                                        label : editor.lang.link.styles,
     793                                                                                        'default' : '',
     794                                                                                        id : 'advStyles',
     795                                                                                        setup : setupAdvParams,
     796                                                                                        commit : commitAdvParams
     797
     798                                                                                }
     799                                                                        ]
     800                                                                }
     801                                                        ]
     802                                                }
     803                                        ]
     804                                }
     805                        ]
    585806                };
    586807        }
    587808
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy