dijit._editor.RichText.onKeyDown
dojo.require("dijit._editor.RichText");
defined in dijit/_editor/RichText.js
Fired on keydown
Usage
function (e) (view source)
// we need this event at the moment to get the events from control keys // such as the backspace. It might be possible to add this to Dojo, so that // keyPress events can be emulated by the keyDown and keyUp detection. if(dojo.isIE){ if(e.keyCode == dojo.keys.TAB && e.shiftKey && !e.ctrlKey && !e.altKey){ // focus the BODY so the browser will tab away from it instead this.iframe.focus(); }else if(e.keyCode == dojo.keys.TAB && !e.shiftKey && !e.ctrlKey && !e.altKey){ // focus the BODY so the browser will tab away from it instead this.tabStop.focus(); }else if(e.keyCode === dojo.keys.BACKSPACE && this.document.selection.type === "Control"){ // IE has a bug where if a non-text object is selected in the editor, // hitting backspace would act as if the browser's back button was // clicked instead of deleting the object. see #1069 dojo.stopEvent(e); this.execCommand("delete"); }else if((65 <= e.keyCode&&e.keyCode <= 90) || (e.keyCode>=37&&e.keyCode<=40) // FIXME: get this from connect() instead! ){ //arrow keys e.charCode = e.keyCode; this.onKeyPress(e); } }else if(dojo.isMoz){ if(e.keyCode == dojo.keys.TAB && !e.shiftKey && !e.ctrlKey && !e.altKey && this.iframe){ // update iframe document title for screen reader this.iframe.contentDocument.title = this._localizedIframeTitles.iframeFocusTitle; // Place focus on the iframe. A subsequent tab or shift tab will put focus // on the correct control. this.iframe.focus(); // this.focus(); won't work dojo.stopEvent(e); }else if(e.keyCode == dojo.keys.TAB && e.shiftKey){ // if there is a toolbar, set focus to it, otherwise ignore if(this.toolbar){ this.toolbar.focus(); } dojo.stopEvent(e); } }
parameter | type | description |
---|---|---|
e |