2 lines
7.2 KiB
JavaScript
2 lines
7.2 KiB
JavaScript
|
//>>built
|
||
|
define("dijit/_editor/plugins/FontChoice",["require","dojo/_base/array","dojo/_base/declare","dojo/dom-construct","dojo/i18n","dojo/_base/lang","dojo/string","dojo/store/Memory","../../registry","../../_Widget","../../_TemplatedMixin","../../_WidgetsInTemplateMixin","../../form/FilteringSelect","../_Plugin","../range","dojo/i18n!../nls/FontChoice"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f){var _10=_3("dijit._editor.plugins._FontDropDown",[_a,_b,_c],{label:"",plainText:false,templateString:"<span style='white-space: nowrap' class='dijit dijitReset dijitInline'>"+"<label class='dijitLeft dijitInline' for='${selectId}'>${label}</label>"+"<input data-dojo-type='../../form/FilteringSelect' required='false' "+"data-dojo-props='labelType:\"html\", labelAttr:\"label\", searchAttr:\"name\"' "+"class='${comboClass}' "+"tabIndex='-1' id='${selectId}' data-dojo-attach-point='select' value=''/>"+"</span>",contextRequire:_1,postMixInProperties:function(){this.inherited(arguments);this.strings=_5.getLocalization("dijit._editor","FontChoice");this.label=this.strings[this.command];this.id=_9.getUniqueId(this.declaredClass.replace(/\./g,"_"));this.selectId=this.id+"_select";this.inherited(arguments);},postCreate:function(){this.select.set("store",new _8({idProperty:"value",data:_2.map(this.values,function(_11){var _12=this.strings[_11]||_11;return {label:this.getLabel(_11,_12),name:_12,value:_11};},this)}));this.select.set("value","",false);this.disabled=this.select.get("disabled");},_setValueAttr:function(_13,_14){_14=_14!==false;this.select.set("value",_2.indexOf(this.values,_13)<0?"":_13,_14);if(!_14){this.select._lastValueReported=null;}},_getValueAttr:function(){return this.select.get("value");},focus:function(){this.select.focus();},_setDisabledAttr:function(_15){this._set("disabled",_15);this.select.set("disabled",_15);}});var _16=_3("dijit._editor.plugins._FontNameDropDown",_10,{generic:false,command:"fontName",comboClass:"dijitFontNameCombo",postMixInProperties:function(){if(!this.values){this.values=this.generic?["serif","sans-serif","monospace","cursive","fantasy"]:["Arial","Times New Roman","Comic Sans MS","Courier New"];}this.inherited(arguments);},getLabel:function(_17,_18){if(this.plainText){return _18;}else{return "<div style='font-family: "+_17+"'>"+_18+"</div>";}},_normalizeFontName:function(_19){var _1a=this.values;if(!_19||!_1a){return _19;}var _1b=_19.split(",");if(_1b.length>1){for(var i=0,l=_1b.length;i<l;i++){var _1c=_7.trim(_1b[i]);var pos=_2.indexOf(_1a,_1c);if(pos>-1){return _1c;}}}return _19;},_setValueAttr:function(_1d,_1e){_1e=_1e!==false;_1d=this._normalizeFontName(_1d);if(this.generic){var map={"Arial":"sans-serif","Helvetica":"sans-serif","Myriad":"sans-serif","Times":"serif","Times New Roman":"serif","Comic Sans MS":"cursive","Apple Chancery":"cursive","Courier":"monospace","Courier New":"monospace","Papyrus":"fantasy","Estrangelo Edessa":"cursive","Gabriola":"fantasy"};_1d=map[_1d]||_1d;}this.inherited(arguments,[_1d,_1e]);}});var _1f=_3("dijit._editor.plugins._FontSizeDropDown",_10,{command:"fontSize",comboClass:"dijitFontSizeCombo",values:[1,2,3,4,5,6,7],getLabel:function(_20,_21){if(this.plainText){return _21;}else{return "<font size="+_20+"'>"+_21+"</font>";}},_setValueAttr:function(_22,_23){_23=_23!==false;if(_22.indexOf&&_22.indexOf("px")!=-1){var _24=parseInt(_22,10);_22={10:1,13:2,16:3,18:4,24:5,32:6,48:7}[_24]||_22;}this.inherited(arguments,[_22,_23]);}});var _25=_3("dijit._editor.plugins._FormatBlockDropDown",_10,{command:"formatBlock",comboClass:"dijitFormatBlockCombo",values:["noFormat","p","h1","h2","h3","pre"],postCreate:function(){this.inherited(arguments);this.set("value","noFormat",false);},getLabel:function(_26,_27){if(this.plainText||_26=="noFormat"){return _27;}else{return "<"+_26+">"+_27+"</"+_26+">";}},_execCommand:function(_28,_29,_2a){if(_2a==="noFormat"){var _2b;var end;var sel=_f.getSelection(_28.window);if(sel&&sel.rangeCount>0){var _2c=sel.getRangeAt(0);var _2d,tag;if(_2c){_2b=_2c.startContainer;end=_2c.endContainer;while(_2b&&_2b!==_28.editNode&&_2b!==_28.docume
|