X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=plugins%2Fliststyle%2Fdialogs%2Fliststyle.js;h=d3af4189df339fcdaa1442918a1e2be4b80cf630;hp=978a199be092abc1395d739a7b68aac8d6f1d5bb;hb=refs%2Ftags%2Fv3.6.1;hpb=4e70ea24db840898be8cc21c950363a52a2a6aba diff --git a/plugins/liststyle/dialogs/liststyle.js b/plugins/liststyle/dialogs/liststyle.js index 978a199..d3af418 100644 --- a/plugins/liststyle/dialogs/liststyle.js +++ b/plugins/liststyle/dialogs/liststyle.js @@ -3,4 +3,5 @@ Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ -(function(){function a(d,e){var f;try{f=d.getSelection().getRanges()[0];}catch(g){return null;}f.shrink(CKEDITOR.SHRINK_TEXT);return f.getCommonAncestor().getAscendant(e,1);};var b={a:'lower-alpha',A:'upper-alpha',i:'lower-roman',I:'upper-roman',1:'decimal',disc:'disc',circle:'circle',square:'square'};function c(d,e){var f=d.lang.list;if(e=='bulletedListStyle')return{title:f.bulletedTitle,minWidth:300,minHeight:50,contents:[{id:'info',accessKey:'I',elements:[{type:'select',label:f.type,id:'type',style:'width: 150px; margin: auto;',items:[[f.notset,''],[f.circle,'circle'],[f.disc,'disc'],[f.square,'square']],setup:function(h){var i=h.getStyle('list-style-type')||b[h.getAttribute('type')]||h.getAttribute('type')||'';this.setValue(i);},commit:function(h){var i=this.getValue();if(i)h.setStyle('list-style-type',i);else h.removeStyle('list-style-type');}}]}],onShow:function(){var h=this.getParentEditor(),i=a(h,'ul');i&&this.setupContent(i);},onOk:function(){var h=this.getParentEditor(),i=a(h,'ul');i&&this.commitContent(i);}};else if(e=='numberedListStyle'){var g=[[f.notset,''],[f.lowerRoman,'lower-roman'],[f.upperRoman,'upper-roman'],[f.lowerAlpha,'lower-alpha'],[f.upperAlpha,'upper-alpha'],[f.decimal,'decimal']];if(!CKEDITOR.env.ie||CKEDITOR.env.version>7)g.concat([[f.armenian,'armenian'],[f.decimalLeadingZero,'decimal-leading-zero'],[f.georgian,'georgian'],[f.lowerGreek,'lower-greek']]);return{title:f.numberedTitle,minWidth:300,minHeight:50,contents:[{id:'info',accessKey:'I',elements:[{type:'hbox',widths:['25%','75%'],children:[{label:f.start,type:'text',id:'start',validate:CKEDITOR.dialog.validate.integer(f.validateStartNumber),setup:function(h){var i=h.getAttribute('start')||1;i&&this.setValue(i);},commit:function(h){h.setAttribute('start',this.getValue());}},{type:'select',label:f.type,id:'type',style:'width: 100%;',items:g,setup:function(h){var i=h.getStyle('list-style-type')||b[h.getAttribute('type')]||h.getAttribute('type')||'';this.setValue(i);},commit:function(h){var i=this.getValue();if(i)h.setStyle('list-style-type',i);else h.removeStyle('list-style-type');}}]}]}],onShow:function(){var h=this.getParentEditor(),i=a(h,'ol');i&&this.setupContent(i);},onOk:function(){var h=this.getParentEditor(),i=a(h,'ol');i&&this.commitContent(i);}};}};CKEDITOR.dialog.add('numberedListStyle',function(d){return c(d,'numberedListStyle');});CKEDITOR.dialog.add('bulletedListStyle',function(d){return c(d,'bulletedListStyle');});})(); +(function(){function a(e,f){var g;try{g=e.getSelection().getRanges()[0];}catch(h){return null;}g.shrink(CKEDITOR.SHRINK_TEXT);return g.getCommonAncestor().getAscendant(f,1);};var b=function(e){return e.type==CKEDITOR.NODE_ELEMENT&&e.is('li');},c={a:'lower-alpha',A:'upper-alpha',i:'lower-roman',I:'upper-roman',1:'decimal',disc:'disc',circle:'circle',square:'square'};function d(e,f){var g=e.lang.list;if(f=='bulletedListStyle')return{title:g.bulletedTitle,minWidth:300,minHeight:50,contents:[{id:'info',accessKey:'I',elements:[{type:'select',label:g.type,id:'type',align:'center',style:'width:150px',items:[[g.notset,''],[g.circle,'circle'],[g.disc,'disc'],[g.square,'square']],setup:function(i){var j=i.getStyle('list-style-type')||c[i.getAttribute('type')]||i.getAttribute('type')||'';this.setValue(j);},commit:function(i){var j=this.getValue();if(j)i.setStyle('list-style-type',j);else i.removeStyle('list-style-type');}}]}],onShow:function(){var i=this.getParentEditor(),j=a(i,'ul');j&&this.setupContent(j);},onOk:function(){var i=this.getParentEditor(),j=a(i,'ul');j&&this.commitContent(j);}};else if(f=='numberedListStyle'){var h=[[g.notset,''],[g.lowerRoman,'lower-roman'],[g.upperRoman,'upper-roman'],[g.lowerAlpha,'lower-alpha'],[g.upperAlpha,'upper-alpha'],[g.decimal,'decimal']];if(!CKEDITOR.env.ie||CKEDITOR.env.version>7)h.concat([[g.armenian,'armenian'],[g.decimalLeadingZero,'decimal-leading-zero'],[g.georgian,'georgian'],[g.lowerGreek,'lower-greek']]);return{title:g.numberedTitle,minWidth:300,minHeight:50,contents:[{id:'info',accessKey:'I',elements:[{type:'hbox',widths:['25%','75%'],children:[{label:g.start,type:'text',id:'start',validate:CKEDITOR.dialog.validate.integer(g.validateStartNumber),setup:function(i){var j=i.getFirst(b).getAttribute('value')||i.getAttribute('start')||1;j&&this.setValue(j);},commit:function(i){var j=i.getFirst(b),k=j.getAttribute('value')||i.getAttribute('start')||1;i.getFirst(b).removeAttribute('value');var l=parseInt(this.getValue(),10);if(isNaN(l))i.removeAttribute('start');else i.setAttribute('start',l);var m=j,n=k,o=isNaN(l)?1:l;while((m=m.getNext(b))&&n++){if(m.getAttribute('value')==n)m.setAttribute('value',o+n-k);}}},{type:'select',label:g.type,id:'type',style:'width: 100%;',items:h,setup:function(i){var j=i.getStyle('list-style-type')||c[i.getAttribute('type')]||i.getAttribute('type')||'';this.setValue(j);},commit:function(i){var j=this.getValue();if(j)i.setStyle('list-style-type',j);else i.removeStyle('list-style-type');}}]}]}],onShow:function(){var i=this.getParentEditor(),j=a(i,'ol'); +j&&this.setupContent(j);},onOk:function(){var i=this.getParentEditor(),j=a(i,'ol');j&&this.commitContent(j);}};}};CKEDITOR.dialog.add('numberedListStyle',function(e){return d(e,'numberedListStyle');});CKEDITOR.dialog.add('bulletedListStyle',function(e){return d(e,'bulletedListStyle');});})();