dijit._editor.plugins.FontChoice.updateState
dojo.require("dijit._editor.plugins.FontChoice");
defined in dijit/_editor/plugins/FontChoice.js
Usage
function () (view source)
this.inherited(arguments); var _e = this.editor; var _c = this.command; if(!_e || !_e.isLoaded || !_c.length){ return; } if(this.button){ var value = _e.queryCommandValue(this.editor._normalizeCommand(_c)) || ""; // strip off single quotes, if any var quoted = dojo.isString(value) && value.match(/'([^']*)'/); if(quoted){ value = quoted[1]; } //console.log("selected " + value); if(this.generic && _c == "fontName"){ 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" // ,"????": "fantasy" TODO: IE doesn't map fantasy font-family? }; //console.log("mapped to " + map[value]); value = map[value] || value; }else if(_c == "fontSize" && value.indexOf && value.indexOf("px") != -1){ var pixels = parseInt(value); value = {10:1, 13:2, 16:3, 18:4, 24:5, 32:6, 48:7}[pixels] || value; } this.updating = true; this.button.setValue(value); delete this.updating; } // FIXME: IE is *really* b0rken if(dojo.isIE){ this._savedSelection = this.editor._getBookmark(); } this._focusHandle = dijit.getFocus(this.editor.iframe);