X-Git-Url: https://scm.cri.ensmp.fr/git/ckeditor.git/blobdiff_plain/871bad8291b6dbc29d489d95d185458caab25158..b67a02e371649e700299602f4ccee716fa3903e2:/skins/ckeditor/plugins/table/dialogs/table.js diff --git a/skins/ckeditor/plugins/table/dialogs/table.js b/skins/ckeditor/plugins/table/dialogs/table.js index d5e244e..6f65681 100644 --- a/skins/ckeditor/plugins/table/dialogs/table.js +++ b/skins/ckeditor/plugins/table/dialogs/table.js @@ -1,9 +1,21 @@ -/* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function(){var a=CKEDITOR.tools.cssLength,b=function(d){var e=this.id;if(!d.info)d.info={};d.info[e]=this.getValue();};function c(d,e){var f=function(h){return new CKEDITOR.dom.element(h,d.document);},g=d.plugins.dialogadvtab;return{title:d.lang.table.title,minWidth:310,minHeight:CKEDITOR.env.ie?310:280,onLoad:function(){var h=this,i=h.getContentElement('advanced','advStyles');if(i)i.on('change',function(j){var k=this.getStyle('width',''),l=h.getContentElement('info','txtWidth');l&&l.setValue(k,true);var m=this.getStyle('height',''),n=h.getContentElement('info','txtHeight');n&&n.setValue(m,true);});},onShow:function(){var p=this;var h=d.getSelection(),i=h.getRanges(),j=null,k=p.getContentElement('info','txtRows'),l=p.getContentElement('info','txtCols'),m=p.getContentElement('info','txtWidth'),n=p.getContentElement('info','txtHeight');if(e=='tableProperties'){if(j=h.getSelectedElement())j=j.getAscendant('table',true);else if(i.length>0){if(CKEDITOR.env.webkit)i[0].shrink(CKEDITOR.NODE_ELEMENT);var o=i[0].getCommonAncestor(true);j=o.getAscendant('table',true);}p._.selectedElement=j;}if(j){p.setupContent(j);k&&k.disable();l&&l.disable();}else{k&&k.enable();l&&l.enable();}m&&m.onChange();n&&n.onChange();},onOk:function(){var h=d.getSelection(),i=this._.selectedElement&&h.createBookmarks(),j=this._.selectedElement||f('table'),k=this,l={};this.commitContent(l,j);if(l.info){var m=l.info;if(!this._.selectedElement){var n=j.append(f('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(d.lang.table.invalidRows);this.select();}return h;},setup:function(h){this.setValue(h.$.rows.length);},commit:b},{type:'text',id:'txtCols','default':2,label:d.lang.table.columns,required:true,controlStyle:'width:5em',validate:function(){var h=true,i=this.getValue();h=h&&CKEDITOR.dialog.validate.integer()(i)&&i>0;if(!h){alert(d.lang.table.invalidCols);this.select();}return h;},setup:function(h){this.setValue(h.$.rows[0].cells.length);},commit:b},{type:'html',html:' '},{type:'select',id:'selHeaders','default':'',label:d.lang.table.headers,items:[[d.lang.table.headersNone,''],[d.lang.table.headersRow,'row'],[d.lang.table.headersColumn,'col'],[d.lang.table.headersBoth,'both']],setup:function(h){var i=this.getDialog();i.hasColumnHeaders=true;for(var j=0;j0){var j=i.getItem(0),k=j.getFirst(CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_ELEMENT));if(k&&!k.equals(j.getBogus())){l.disable();l.setValue(j.getText());return;}j=CKEDITOR.tools.trim(j.getText());l.setValue(j);}},commit:function(h,i){if(!this.isEnabled())return;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',d.document);if(i.getChildCount())k.insertBefore(i.getFirst()); -else k.appendTo(i);}k.append(new CKEDITOR.dom.text(j,d.document));}else if(k.count()>0)for(var l=k.count()-1;l>=0;l--)k.getItem(l).remove();}},{type:'text',id:'txtSummary',label:d.lang.table.summary,setup:function(h){this.setValue(h.getAttribute('summary')||'');},commit:function(h,i){if(this.getValue())i.setAttribute('summary',this.getValue());else i.removeAttribute('summary');}}]}]},g&&g.createAdvancedTab(d)]};};CKEDITOR.dialog.add('table',function(d){return c(d,'table');});CKEDITOR.dialog.add('tableProperties',function(d){return c(d,'tableProperties');});})(); +/* + Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +(function(){function r(a){for(var e=0,l=0,k=0,m,g=a.$.rows.length;kl&&(l=e)}return l}function o(a){return function(){var e=this.getValue(),e=!!(CKEDITOR.dialog.validate.integer()(e)&&0n.getSize("width")?"100%":500:0,getValue:q,validate:CKEDITOR.dialog.validate.cssLength(a.lang.common.invalidCssLength.replace("%1",a.lang.common.width)),onChange:function(){var a=this.getDialog().getContentElement("advanced","advStyles");a&& +a.updateStyle("width",this.getValue())},setup:function(a){this.setValue(a.getStyle("width"))},commit:k}]},{type:"hbox",widths:["5em"],children:[{type:"text",id:"txtHeight",requiredContent:"table{height}",controlStyle:"width:5em",label:a.lang.common.height,title:a.lang.common.cssLengthTooltip,"default":"",getValue:q,validate:CKEDITOR.dialog.validate.cssLength(a.lang.common.invalidCssLength.replace("%1",a.lang.common.height)),onChange:function(){var a=this.getDialog().getContentElement("advanced","advStyles"); +a&&a.updateStyle("height",this.getValue())},setup:function(a){(a=a.getStyle("height"))&&this.setValue(a)},commit:k}]},{type:"html",html:" "},{type:"text",id:"txtCellSpace",requiredContent:"table[cellspacing]",controlStyle:"width:3em",label:a.lang.table.cellSpace,"default":a.filter.check("table[cellspacing]")?1:0,validate:CKEDITOR.dialog.validate.number(a.lang.table.invalidCellSpacing),setup:function(a){this.setValue(a.getAttribute("cellSpacing")||"")},commit:function(a,d){this.getValue()?d.setAttribute("cellSpacing", +this.getValue()):d.removeAttribute("cellSpacing")}},{type:"text",id:"txtCellPad",requiredContent:"table[cellpadding]",controlStyle:"width:3em",label:a.lang.table.cellPad,"default":a.filter.check("table[cellpadding]")?1:0,validate:CKEDITOR.dialog.validate.number(a.lang.table.invalidCellPadding),setup:function(a){this.setValue(a.getAttribute("cellPadding")||"")},commit:function(a,d){this.getValue()?d.setAttribute("cellPadding",this.getValue()):d.removeAttribute("cellPadding")}}]}]},{type:"html",align:"right", +html:""},{type:"vbox",padding:0,children:[{type:"text",id:"txtCaption",requiredContent:"caption",label:a.lang.table.caption,setup:function(a){this.enable();a=a.getElementsByTag("caption");if(0