| | 225 | |
| | 226 | for ( row = 0; row < table.$.rows.length; row++ ) { |
| | 227 | for (index = 0, len = table.$.rows[ row ].cells.length; index < len; ++index) { |
| | 228 | newCell = new CKEDITOR.dom.element( table.$.rows[ row ].cells[ index ] ); |
| | 229 | if(table.getStyle('border-width')){ |
| | 230 | newCell.setStyle('border-width', table.getStyle('border-width')); |
| | 231 | } |
| | 232 | else{ |
| | 233 | newCell.removeStyle('border'); |
| | 234 | } |
| | 235 | if(table.getAttribute('cellPadding')>0){ |
| | 236 | newCell.setStyle('padding', table.getAttribute('cellPadding')+'px'); |
| | 237 | } |
| | 238 | else{ |
| | 239 | newCell.removeStyle('padding'); |
| | 240 | } |
| | 241 | if(table.getStyle('border-color')){ |
| | 242 | newCell.setStyle('border-color', table.getStyle('border-color')); |
| | 243 | } |
| | 244 | else{ |
| | 245 | newCell.removeStyle('border-color'); |
| | 246 | } |
| | 247 | if(table.getStyle('border-style')){ |
| | 248 | newCell.setStyle('border-style', table.getStyle('border-style')); |
| | 249 | } |
| | 250 | else{ |
| | 251 | newCell.removeStyle('border-style'); |
| | 252 | } |
| | 253 | } |
| | 254 | } |
| | 255 | table.removeAttribute('cellPadding'); |
| | 391 | |
| | 392 | { |
| | 393 | type: 'text', |
| | 394 | id: 'txtBorderColor', |
| | 395 | requiredContent: 'table{border-color}', |
| | 396 | label: editor.lang.table.borderColor, |
| | 397 | 'default': '#cccccc', |
| | 398 | setup: function( selectedTable ) { |
| | 399 | if(selectedTable.getStyle('border-color')){ |
| | 400 | this.setValue(selectedTable.getStyle('border-color')); |
| | 401 | } |
| | 402 | else if(selectedTable.getAttribute('bordercolor')){ |
| | 403 | this.setValue(selectedTable.getAttribute('bordercolor')); |
| | 404 | selectedTable.removeAttribute('bordercolor'); |
| | 405 | } |
| | 406 | else{ |
| | 407 | this.setValue(''); |
| | 408 | } |
| | 409 | }, |
| | 410 | commit: function( data, selectedTable ) { |
| | 411 | if(this.getValue()){ |
| | 412 | selectedTable.setStyle('border-color', this.getValue()); |
| | 413 | } |
| | 414 | else{ |
| | 415 | selectedTable.removeStyle('border-color'); |
| | 416 | } |
| | 417 | } |
| | 418 | }, |
| | 419 | |
| | 420 | { |
| | 421 | id: 'cmbBorderstyle', |
| | 422 | type: 'select', |
| | 423 | requiredContent: 'table{border-style}', |
| | 424 | 'default': 'solid', |
| | 425 | label: editor.lang.common.borderstyle, |
| | 426 | items: [ |
| | 427 | [ editor.lang.common.notSet, '' ], |
| | 428 | [ editor.lang.common.borderstyleNone, 'none' ], |
| | 429 | [ editor.lang.common.borderstyleSolid, 'solid' ], |
| | 430 | [ editor.lang.common.borderstyleDotted, 'dotted' ], |
| | 431 | [ editor.lang.common.borderstyleDashed, 'dashed' ], |
| | 432 | [ editor.lang.common.borderstyleHidden, 'hidden' ], |
| | 433 | [ editor.lang.common.borderstyleDouble, 'double' ], |
| | 434 | [ editor.lang.common.borderstyleGroove, 'groove' ], |
| | 435 | [ editor.lang.common.borderstyleRidge, 'ridge' ], |
| | 436 | [ editor.lang.common.borderstyleInset, 'inset' ], |
| | 437 | [ editor.lang.common.borderstyleOutset, 'outset' ], |
| | 438 | [ editor.lang.common.borderstyleInitial, 'initial' ], |
| | 439 | [ editor.lang.common.borderstyleInherit, 'inherit' ] |
| | 440 | ], |
| | 441 | setup: function( selectedTable ) { |
| | 442 | if(this.getValue(selectedTable.getStyle('border-style'))){ |
| | 443 | this.setValue(selectedTable.getStyle('border-style')); |
| | 444 | } |
| | 445 | else{ |
| | 446 | this.setValue('solid'); |
| | 447 | } |
| | 448 | }, |
| | 449 | commit: function( data, selectedTable ) { |
| | 450 | if (this.getValue()){ |
| | 451 | selectedTable.setStyle('border-style', this.getValue()); |
| | 452 | } |
| | 453 | else { |
| | 454 | selectedTable.setStyle('border-style', ''); |
| | 455 | } |
| | 456 | } |
| | 457 | }, |
| | 458 | |
| 359 | | if ( this.getValue() ) |
| 360 | | selectedTable.setAttribute( 'align', this.getValue() ); |
| 361 | | else |
| 362 | | selectedTable.removeAttribute( 'align' ); |
| | 486 | if(this.getValue()){ |
| | 487 | if(this.getValue()=='left'){ |
| | 488 | selectedTable.setStyle('float', 'left'); |
| | 489 | selectedTable.removeStyle('margin-left'); |
| | 490 | selectedTable.removeStyle('margin-right'); |
| | 491 | } |
| | 492 | else if(this.getValue()=='right'){ |
| | 493 | selectedTable.setStyle('float', 'right'); |
| | 494 | selectedTable.removeStyle('margin-left'); |
| | 495 | selectedTable.removeStyle('margin-right'); |
| | 496 | } |
| | 497 | else if(this.getValue()=='center'){ |
| | 498 | selectedTable.setStyle('margin-left', 'auto'); |
| | 499 | selectedTable.setStyle('margin-right', 'auto'); |
| | 500 | selectedTable.removeStyle('float'); |
| | 501 | } |
| | 502 | } |
| | 503 | else{ |
| | 504 | selectedTable.removeStyle('margin-left'); |
| | 505 | selectedTable.removeStyle('margin-right'); |
| | 506 | selectedTable.removeStyle('float'); |
| | 507 | } |
| | 508 | selectedTable.removeAttribute('align'); |
| 441 | | if ( this.getValue() ) |
| 442 | | selectedTable.setAttribute( 'cellSpacing', this.getValue() ); |
| 443 | | else |
| 444 | | selectedTable.removeAttribute( 'cellSpacing' ); |
| | 595 | if(this.getValue()){ |
| | 596 | if(this.getValue()>0){ |
| | 597 | selectedTable.setStyle('border-collapse', 'separate'); |
| | 598 | } |
| | 599 | else{ |
| | 600 | selectedTable.setStyle('border-collapse', 'collapse'); |
| | 601 | } |
| | 602 | selectedTable.setStyle('border-spacing', this.getValue()+'px'); |
| | 603 | } |
| | 604 | else{ |
| | 605 | selectedTable.setStyle('border-collapse', 'collapse'); |
| | 606 | selectedTable.removeStyle('border-spacing'); |
| | 607 | } |
| | 608 | selectedTable.removeAttribute('cellSpacing'); |
| 456 | | this.setValue( selectedTable.getAttribute( 'cellPadding' ) || '' ); |
| | 620 | if(selectedTable.getAttribute('cellpadding')){ |
| | 621 | this.setValue(selectedTable.getAttribute('cellpadding')); |
| | 622 | } |
| | 623 | else if(selectedTable.getElementsByTag('tbody').getItem(0)){ |
| | 624 | var cellpadding=0; |
| | 625 | var tbody = selectedTable.getElementsByTag('tbody').getItem(0); |
| | 626 | var theRow = tbody.getElementsByTag('tr').getItem(0); |
| | 627 | var td = theRow.getChild(0); |
| | 628 | if(td.getStyle('padding')){ |
| | 629 | this.setValue(td.getStyle('padding').replace('px','')); |
| | 630 | } |
| | 631 | else{ |
| | 632 | if(selectedTable.getElementsByTag('thead').getItem(0)){ |
| | 633 | var thead = selectedTable.getElementsByTag('thead').getItem(0); |
| | 634 | var thead = tbody.getElementsByTag('tr').getItem(0); |
| | 635 | var th = theRow.getChild(0); |
| | 636 | if(th.getStyle('padding')){ |
| | 637 | this.setValue(th.getStyle('padding').replace('px','')); |
| | 638 | } |
| | 639 | else{ |
| | 640 | this.setValue(''); |
| | 641 | } |
| | 642 | } |
| | 643 | else{ |
| | 644 | this.setValue(''); |
| | 645 | } |
| | 646 | } |
| | 647 | } |