diff --git a/nicEdit.js b/nicEdit.js index 9f7eed2..0ba0c87 100644 --- a/nicEdit.js +++ b/nicEdit.js @@ -272,7 +272,7 @@ var nicEditorConfig = bkClass.extend({ }, iconsPath : '../nicEditorIcons.gif', buttonList : ['save','bold','italic','underline','strikethrough','left','center','right','justify','ol','ul','fontSize','fontFamily','fontFormat','image','upload','link','unlink','removeformat','forecolor','bgcolor','indent','outdent','subscript','superscript','xhtml','table'], - iconList : {"xhtml":1,"bgcolor":2,"forecolor":3,"bold":4,"center":5,"hr":6,"indent":7,"italic":8,"justify":9,"left":10,"ol":11,"outdent":12,"removeformat":13,"right":14,"save":25,"strikethrough":16,"subscript":17,"superscript":18,"ul":19,"underline":20,"image":21,"link":22,"unlink":23,"close":24,"arrow":26,"upload":27} + iconList : {"xhtml":1,"bgcolor":2,"forecolor":3,"bold":4,"center":5,"hr":6,"indent":7,"italic":8,"justify":9,"left":10,"ol":11,"outdent":12,"removeformat":13,"right":14,"save":25,"strikethrough":16,"subscript":17,"superscript":18,"ul":19,"underline":20,"image":21,"link":22,"unlink":23,"close":24,"arrow":26,"upload":27,"table":28} }); /* END CONFIG */ @@ -1622,44 +1622,68 @@ var nicTableOptions = { var nicTableButton = nicEditorAdvancedButton.extend({ addPane : function() { this.t = this.ne.selectedInstance.selElm().parentTag('TABLE'); + var r = 3, c = 3, h = ''; + if (this.t && (r = this.t.rows.length)) { + c = this.t.rows[0].cells.length; + if (this.t.rows[0].cells[c-1].nodeName == 'TH') h += 'top'; + if (this.t.rows[r-1].cells[0].nodeName == 'TH') h += 'left'; + } this.addForm({ - '' : {type : 'title', txt : __('Add/Edit Table')}, - 'cols' : {type : 'text', txt : __('Columns'), 'value' : '3', style : {width: '50px'}}, - 'rows' : {type : 'text', txt : __('Rows'), 'value' : '3', style : {width: '50px'}}, + '': {type: 'title', txt: __('Add/Edit Table')}, + 'cols': {type: 'text', txt: __('Columns'), value: c, style: {width: '50px'}}, + 'rows': {type: 'text', txt: __('Rows'), value: r, style: {width: '50px'}}, + 'header': {type: 'select', txt: __('Headers'), value: h, options: {'':__('None'), left:__('Left'), top:__('Top'), topleft:__('Top and Left')}} },this.t); }, submit : function(e) { var r = parseInt(this.inputs['rows'].value); var c = parseInt(this.inputs['cols'].value); + var i, j; if(!this.t) { var tmp = 'javascript:nicImTemp();', h = ''; - for (var i = 0; i < r; i++) { + for (i = 0; i < r; i++) { h += '