X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=plugins%2Ftable%2Fdialogs%2Ftable.js;h=65cbd50154ccc03f5799489c8dc4c0788897318e;hp=d4789c23ed7e97d638102387a970b445e401fb96;hb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;hpb=059b4c2fef02528bf1af189f7996e80652faddfb diff --git a/plugins/table/dialogs/table.js b/plugins/table/dialogs/table.js index d4789c2..65cbd50 100644 --- a/plugins/table/dialogs/table.js +++ b/plugins/table/dialogs/table.js @@ -6,4 +6,4 @@ For licensing, see LICENSE.html or http://ckeditor.com/license (function(){var a=/^(\d+(?:\.\d+)?)(px|%)$/,b=/^(\d+(?:\.\d+)?)px$/,c=function(e){var f=this.id;if(!e.info)e.info={};e.info[f]=this.getValue();};function d(e,f){var g=function(h){return new CKEDITOR.dom.element(h,e.document);};return{title:e.lang.table.title,minWidth:310,minHeight:CKEDITOR.env.ie?310:280,onShow:function(){var o=this;var h=e.getSelection(),i=h.getRanges(),j=null,k=o.getContentElement('info','txtRows'),l=o.getContentElement('info','txtCols'),m=o.getContentElement('info','txtWidth');if(f=='tableProperties'){if(j=e.getSelection().getSelectedElement()){if(j.getName()!='table')j=null;}else if(i.length>0){var n=i[0].getCommonAncestor(true);j=n.getAscendant('table',true);}o._.selectedElement=j;}if(j){o.setupContent(j);k&&k.disable();l&&l.disable();m&&m.select();}else{k&&k.enable();l&&l.enable();k&&k.select();}},onOk:function(){var C=this;if(C._.selectedElement)var h=e.getSelection(),i=e.getSelection().createBookmarks();var j=C._.selectedElement||g('table'),k=C,l={};C.commitContent(l,j);if(l.info){var m=l.info;if(!C._.selectedElement){var n=j.append(g('tbody')),o=parseInt(m.txtRows,10)||0,p=parseInt(m.txtCols,10)||0;for(var q=0;q0){w=v.getFirst();for(q=0;q0;if(!h){alert(e.lang.table.invalidRows);this.select();}return h;},setup:function(h){this.setValue(h.$.rows.length);},commit:c},{type:'text',id:'txtCols','default':2,label:e.lang.table.columns,style:'width:5em',validate:function(){var h=true,i=this.getValue();h=h&&CKEDITOR.dialog.validate.integer()(i)&&i>0;if(!h){alert(e.lang.table.invalidCols);this.select();}return h;},setup:function(h){this.setValue(h.$.rows[0].cells.length);},commit:c},{type:'html',html:' '},{type:'select',id:'selHeaders','default':'',label:e.lang.table.headers,items:[[e.lang.table.headersNone,''],[e.lang.table.headersRow,'row'],[e.lang.table.headersColumn,'col'],[e.lang.table.headersBoth,'both']],setup:function(h){var i=this.getDialog();i.hasColumnHeaders=true;for(var j=0;j
'+e.lang.table.widthPx+''}]},{type:'html',html:' '},{type:'text',id:'txtCellSpace',style:'width:3em',label:e.lang.table.cellSpace,'default':1,validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidCellSpacing),setup:function(h){this.setValue(h.getAttribute('cellSpacing')||'');},commit:function(h,i){if(this.getValue())i.setAttribute('cellSpacing',this.getValue());else i.removeAttribute('cellSpacing');}},{type:'text',id:'txtCellPad',style:'width:3em',label:e.lang.table.cellPad,'default':1,validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidCellPadding),setup:function(h){this.setValue(h.getAttribute('cellPadding')||'');},commit:function(h,i){if(this.getValue())i.setAttribute('cellPadding',this.getValue());else i.removeAttribute('cellPadding');}}]}]},{type:'html',align:'right',html:''},{type:'vbox',padding:0,children:[{type:'text',id:'txtCaption',label:e.lang.table.caption,setup:function(h){var i=h.getElementsByTag('caption');if(i.count()>0){var j=i.getItem(0);j=j.getChild(0)&&j.getChild(0).getText()||'';j=CKEDITOR.tools.trim(j);this.setValue(j);}},commit:function(h,i){var j=this.getValue(),k=i.getElementsByTag('caption');if(j){if(k.count()>0){k=k.getItem(0);k.setHtml('');}else{k=new CKEDITOR.dom.element('caption',e.document);if(i.getChildCount())k.insertBefore(i.getFirst());else k.appendTo(i);}k.append(new CKEDITOR.dom.text(j,e.document));}else if(k.count()>0)for(var l=k.count()-1;l>=0;l--)k.getItem(l).remove();}},{type:'text',id:'txtSummary',label:e.lang.table.summary,setup:function(h){this.setValue(h.getAttribute('summary')||''); -},commit:function(h,i){if(this.getValue())i.setAttribute('summary',this.getValue());}}]}]}]};};CKEDITOR.dialog.add('table',function(e){return d(e,'table');});CKEDITOR.dialog.add('tableProperties',function(e){return d(e,'tableProperties');});})(); +},commit:function(h,i){if(this.getValue())i.setAttribute('summary',this.getValue());else i.removeAttribute('summary');}}]}]}]};};CKEDITOR.dialog.add('table',function(e){return d(e,'table');});CKEDITOR.dialog.add('tableProperties',function(e){return d(e,'tableProperties');});})();