dijit._editor.RichText._localizeEditorCommands
dojo.require("dijit._editor.RichText");
defined in dijit/_editor/RichText.js
Usage
function () (view source)
if(this._editorCommandsLocalized){ return; } this._editorCommandsLocalized = true; //in IE, names for blockformat is locale dependent, so we cache the values here //if the normal way fails, we try the hard way to get the list //do not use _cacheLocalBlockFormatNames here, as it will //trigger security warning in IE7 //in the array below, ul can not come directly after ol, //otherwise the queryCommandValue returns Normal for it var formats = ['p', 'pre', 'address', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'div', 'ul']; var localhtml = "", format, i=0; while((format=formats[i++])){ if(format.charAt(1) != 'l'){ localhtml += "<"+format+"><span>content</span></"+format+">"; }else{ localhtml += "<"+format+"><li>content</li></"+format+">"; } } //queryCommandValue returns empty if we hide editNode, so move it out of screen temporary var div=dojo.doc.createElement('div'); div.style.position = "absolute"; div.style.left = "-2000px"; div.style.top = "-2000px"; dojo.doc.body.appendChild(div); div.innerHTML = localhtml; var node = div.firstChild; while(node){ dijit._editor.selection.selectElement(node.firstChild); dojo.withGlobal(this.window, "selectElement", dijit._editor.selection, [node.firstChild]); var nativename = node.tagName.toLowerCase(); this._local2NativeFormatNames[nativename] = dojo.doc.queryCommandValue("formatblock");//this.queryCommandValue("formatblock"); this._native2LocalFormatNames[this._local2NativeFormatNames[nativename]] = nativename; node = node.nextSibling; } dojo.doc.body.removeChild(div);