Ticket #7900: 7900_2.patch

File 7900_2.patch, 2.1 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/showborders/plugin.js

     
    115115                                                                        cssClass = attributes[ 'class' ],
    116116                                                                        border = parseInt( attributes.border, 10 );
    117117
    118                                                                 if ( !border || border <= 0 )
     118                                                                if ( ( !border || border <= 0 ) && ( !cssClass || cssClass.indexOf( showBorderClassName ) == -1 ) )
    119119                                                                        attributes[ 'class' ] = ( cssClass || '' ) + ' ' + showBorderClassName;
    120120                                                        }
    121121                                                }
  • _source/plugins/table/dialogs/table.js

     
    1515                data.info[id] = this.getValue();
    1616        };
    1717
     18        function tableColumns( table )
     19        {
     20                var cols = 0, maxCols = 0;
     21                for ( var i = 0, row, rows = table.$.rows.length; i < rows; i++ )
     22                {
     23                        row = table.$.rows[ i ];
     24                        for ( var j = 0, cell, cells = row.cells.length; j < cells; j++ )
     25                        {
     26                                cell = row.cells[ j ];
     27                                cols += cell.colSpan;
     28                        }
     29
     30                        cols > maxCols && ( maxCols = cols );
     31                }
     32
     33                return maxCols;
     34        }
     35
    1836        function tableDialog( editor, command )
    1937        {
    2038                var makeElement = function( name )
     
    304322                                                                                        },
    305323                                                                                        setup : function( selectedTable )
    306324                                                                                        {
    307                                                                                                 this.setValue( selectedTable.$.rows[0].cells.length);
     325                                                                                                this.setValue( tableColumns( selectedTable ) );
    308326                                                                                        },
    309327                                                                                        commit : commitValue
    310328                                                                                },
     
    334352                                                                                                for ( var row = 0 ; row < selectedTable.$.rows.length ; row++ )
    335353                                                                                                {
    336354                                                                                                        // If just one cell isn't a TH then it isn't a header column
    337                                                                                                         if ( selectedTable.$.rows[row].cells[0].nodeName.toLowerCase() != 'th' )
     355                                                                                                        var headCell = selectedTable.$.rows[row].cells[0];
     356                                                                                                        if ( headCell && headCell.nodeName.toLowerCase() != 'th' )
    338357                                                                                                        {
    339358                                                                                                                dialog.hasColumnHeaders = false;
    340359                                                                                                                break;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy