0byt3m1n1
Path:
/
home
/
mgatv524
/
cms.mgaplay.com.br
/
web
/
dist
/
vendor
/
ckeditor
/
plugins
/
table
/
dialogs
/
[
Home
]
File: table.js
!function(){function e(e){return function(){var t=this.getValue();return(t=!!(CKEDITOR.dialog.validate.integer().call(this,t)&&0<t))||(alert(e),this.select()),t}}function t(t,i){var a=function(e){return new CKEDITOR.dom.element(e,t.document)},o=t.editable(),s=t.plugins.dialogadvtab;return{title:t.lang.table.title,minWidth:310,minHeight:CKEDITOR.env.ie?310:280,getModel:function(e){return"tableProperties"!==this.dialog.getName()?null:(e=(e=e.getSelection())&&e.getRanges()[0])?e._getTableElement({table:1}):null},onLoad:function(){var e=this,t=e.getContentElement("advanced","advStyles");t&&t.on("change",(function(){var t=this.getStyle("width",""),l=e.getContentElement("info","txtWidth");l&&l.setValue(t,!0),t=this.getStyle("height",""),(l=e.getContentElement("info","txtHeight"))&&l.setValue(t,!0)}))},onShow:function(){var e,l=t.getSelection(),n=l.getRanges(),a=this.getContentElement("info","txtRows"),o=this.getContentElement("info","txtCols"),s=this.getContentElement("info","txtWidth"),r=this.getContentElement("info","txtHeight");"tableProperties"==i&&((l=l.getSelectedElement())&&l.is("table")?e=l:0<n.length&&(CKEDITOR.env.webkit&&n[0].shrink(CKEDITOR.NODE_ELEMENT),e=t.elementPath(n[0].getCommonAncestor(!0)).contains("table",1)),this._.selectedElement=e),e?(this.setupContent(e),a&&a.disable(),o&&o.disable()):(a&&a.enable(),o&&o.enable()),s&&s.onChange(),r&&r.onChange()},onOk:function(){var e=t.getSelection(),l=this._.selectedElement&&e.createBookmarks(),n=this._.selectedElement||a("table"),i={};if(this.commitContent(i,n),i.info){if(i=i.info,!this._.selectedElement)for(var o=n.append(a("tbody")),s=parseInt(i.txtRows,10)||0,r=parseInt(i.txtCols,10)||0,d=0;d<s;d++)for(var g=o.append(a("tr")),h=0;h<r;h++)g.append(a("td")).appendBogus();if(s=i.selHeaders,!n.$.tHead&&("row"==s||"both"==s)){for(g=n.getElementsByTag("thead").getItem(0),r=(o=n.getElementsByTag("tbody").getItem(0)).getElementsByTag("tr").getItem(0),g||(g=new CKEDITOR.dom.element("thead")).insertBefore(o),d=0;d<r.getChildCount();d++)(o=r.getChild(d)).type!=CKEDITOR.NODE_ELEMENT||o.data("cke-bookmark")||(o.renameNode("th"),o.setAttribute("scope","col"));g.append(r.remove())}if(null!==n.$.tHead&&"row"!=s&&"both"!=s){for(g=new CKEDITOR.dom.element(n.$.tHead),o=n.getElementsByTag("tbody").getItem(0);0<g.getChildCount();){for(r=g.getFirst(),d=0;d<r.getChildCount();d++)(h=r.getChild(d)).type==CKEDITOR.NODE_ELEMENT&&(h.renameNode("td"),h.removeAttribute("scope"));o.append(r,!0)}g.remove()}if(!this.hasColumnHeaders&&("col"==s||"both"==s))for(g=0;g<n.$.rows.length;g++)(h=new CKEDITOR.dom.element(n.$.rows[g].cells[0])).renameNode("th"),h.setAttribute("scope","row");if(this.hasColumnHeaders&&"col"!=s&&"both"!=s)for(d=0;d<n.$.rows.length;d++)"tbody"==(g=new CKEDITOR.dom.element(n.$.rows[d])).getParent().getName()&&((h=new CKEDITOR.dom.element(g.$.cells[0])).renameNode("td"),h.removeAttribute("scope"));i.txtHeight?n.setStyle("height",i.txtHeight):n.removeStyle("height"),i.txtWidth?n.setStyle("width",i.txtWidth):n.removeStyle("width"),n.getAttribute("style")||n.removeAttribute("style")}if(this._.selectedElement)try{e.selectBookmarks(l)}catch(e){}else t.insertElement(n),setTimeout((function(){var e=new CKEDITOR.dom.element(n.$.rows[0].cells[0]),l=t.createRange();l.moveToPosition(e,CKEDITOR.POSITION_AFTER_START),l.select()}),0)},contents:[{id:"info",label:t.lang.table.title,elements:[{type:"hbox",widths:[null,null],styles:["vertical-align:top"],children:[{type:"vbox",padding:0,children:[{type:"text",id:"txtRows",default:3,label:t.lang.table.rows,required:!0,controlStyle:"width:5em",validate:e(t.lang.table.invalidRows),setup:function(e){this.setValue(e.$.rows.length)},commit:n},{type:"text",id:"txtCols",default:2,label:t.lang.table.columns,required:!0,controlStyle:"width:5em",validate:e(t.lang.table.invalidCols),setup:function(e){this.setValue(function(e){for(var t,l=0,n=0,i=0,a=e.$.rows.length;i<a;i++){for(var o=l=0,s=(t=e.$.rows[i]).cells.length;o<s;o++)l+=t.cells[o].colSpan;l>n&&(n=l)}return n}(e))},commit:n},{type:"html",html:" "},{type:"select",id:"selHeaders",requiredContent:"th",default:"",label:t.lang.table.headers,items:[[t.lang.table.headersNone,""],[t.lang.table.headersRow,"row"],[t.lang.table.headersColumn,"col"],[t.lang.table.headersBoth,"both"]],setup:function(e){var t=this.getDialog();t.hasColumnHeaders=!0;for(var l=0;l<e.$.rows.length;l++){var n=e.$.rows[l].cells[0];if(n&&"th"!=n.nodeName.toLowerCase()){t.hasColumnHeaders=!1;break}}null!==e.$.tHead?this.setValue(t.hasColumnHeaders?"both":"row"):this.setValue(t.hasColumnHeaders?"col":"")},commit:n},{type:"text",id:"txtBorder",requiredContent:"table[border]",default:t.filter.check("table[border]")?1:0,label:t.lang.table.border,controlStyle:"width:3em",validate:CKEDITOR.dialog.validate.number(t.lang.table.invalidBorder),setup:function(e){this.setValue(e.getAttribute("border")||"")},commit:function(e,t){this.getValue()?t.setAttribute("border",this.getValue()):t.removeAttribute("border")}},{id:"cmbAlign",type:"select",requiredContent:"table[align]",default:"",label:t.lang.common.align,items:[[t.lang.common.notSet,""],[t.lang.common.left,"left"],[t.lang.common.center,"center"],[t.lang.common.right,"right"]],setup:function(e){this.setValue(e.getAttribute("align")||"")},commit:function(e,t){this.getValue()?t.setAttribute("align",this.getValue()):t.removeAttribute("align")}}]},{type:"vbox",padding:0,children:[{type:"hbox",widths:["5em"],children:[{type:"text",id:"txtWidth",requiredContent:"table{width}",controlStyle:"width:5em",label:t.lang.common.width,title:t.lang.common.cssLengthTooltip,default:t.filter.check("table{width}")?500>o.getSize("width")?"100%":500:0,getValue:l,validate:CKEDITOR.dialog.validate.cssLength(t.lang.common.invalidCssLength.replace("%1",t.lang.common.width)),onChange:function(){var e=this.getDialog().getContentElement("advanced","advStyles");e&&e.updateStyle("width",this.getValue())},setup:function(e){e=e.getStyle("width"),this.setValue(e)},commit:n}]},{type:"hbox",widths:["5em"],children:[{type:"text",id:"txtHeight",requiredContent:"table{height}",controlStyle:"width:5em",label:t.lang.common.height,title:t.lang.common.cssLengthTooltip,default:"",getValue:l,validate:CKEDITOR.dialog.validate.cssLength(t.lang.common.invalidCssLength.replace("%1",t.lang.common.height)),onChange:function(){var e=this.getDialog().getContentElement("advanced","advStyles");e&&e.updateStyle("height",this.getValue())},setup:function(e){(e=e.getStyle("height"))&&this.setValue(e)},commit:n}]},{type:"html",html:" "},{type:"text",id:"txtCellSpace",requiredContent:"table[cellspacing]",controlStyle:"width:3em",label:t.lang.table.cellSpace,default:t.filter.check("table[cellspacing]")?1:0,validate:CKEDITOR.dialog.validate.number(t.lang.table.invalidCellSpacing),setup:function(e){this.setValue(e.getAttribute("cellSpacing")||"")},commit:function(e,t){this.getValue()?t.setAttribute("cellSpacing",this.getValue()):t.removeAttribute("cellSpacing")}},{type:"text",id:"txtCellPad",requiredContent:"table[cellpadding]",controlStyle:"width:3em",label:t.lang.table.cellPad,default:t.filter.check("table[cellpadding]")?1:0,validate:CKEDITOR.dialog.validate.number(t.lang.table.invalidCellPadding),setup:function(e){this.setValue(e.getAttribute("cellPadding")||"")},commit:function(e,t){this.getValue()?t.setAttribute("cellPadding",this.getValue()):t.removeAttribute("cellPadding")}}]}]},{type:"html",align:"right",html:""},{type:"vbox",padding:0,children:[{type:"text",id:"txtCaption",requiredContent:"caption",label:t.lang.table.caption,setup:function(e){if(this.enable(),0<(e=e.getElementsByTag("caption")).count()){var t=(e=e.getItem(0)).getFirst(CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_ELEMENT));t&&!t.equals(e.getBogus())?(this.disable(),this.setValue(e.getText())):(e=CKEDITOR.tools.trim(e.getText()),this.setValue(e))}},commit:function(e,l){if(this.isEnabled()){var n=this.getValue(),i=l.getElementsByTag("caption");if(n)0<i.count()?(i=i.getItem(0)).setHtml(""):(i=new CKEDITOR.dom.element("caption",t.document),l.append(i,!0)),i.append(new CKEDITOR.dom.text(n,t.document));else if(0<i.count())for(n=i.count()-1;0<=n;n--)i.getItem(n).remove()}}},{type:"text",id:"txtSummary",bidi:!0,requiredContent:"table[summary]",label:t.lang.table.summary,setup:function(e){this.setValue(e.getAttribute("summary")||"")},commit:function(e,t){this.getValue()?t.setAttribute("summary",this.getValue()):t.removeAttribute("summary")}}]}]},s&&s.createAdvancedTab(t,null,"table")]}}var l=CKEDITOR.tools.cssLength,n=function(e){var t=this.id;e.info||(e.info={}),e.info[t]=this.getValue()};CKEDITOR.dialog.add("table",(function(e){return t(e,"table")})),CKEDITOR.dialog.add("tableProperties",(function(e){return t(e,"tableProperties")}))}();