Open GoogleCodeExporter opened 9 years ago
Ext.EventManager.useKeyDown = isUseKeyDown;
// Fix for events keyboard in chrome/iron - webkit
Ext.KeyNav.prototype.getKeyEvent = function(){
return (this.forceKeyDown || Ext.EventManager.useKeyDown) ? 'keydown' : 'keypress';
};
Ext.KeyNav.prototype.enable = function(){
if(this.disabled){
this.el.on(this.getKeyEvent(), this.relay, this);
this.disabled = false;
}
};
Ext.KeyNav.prototype.disable = function(){
if (!this.disabled) {
this.el.un(this.getKeyEvent(), this.relay, this);
this.disabled = true;
}
};
Original comment by marlon...@gmail.com
on 8 Dec 2011 at 12:11
// Fix for events keyboard in chrome/iron - webkit
Ext.grid.CellSelectionModel.prototype.initEvents = function(){
this.grid.on("cellmousedown", this.handleMouseDown, this);
this.grid.getGridEl().on(Ext.EventManager.getKeyEvent(), this.handleKeyDown, this);
var view = this.grid.view;
view.on("refresh", this.onViewChange, this);
view.on("rowupdated", this.onRowUpdated, this);
view.on("beforerowremoved", this.clearSelections, this);
view.on("beforerowsinserted", this.clearSelections, this);
if(this.grid.isEditor){
this.grid.on("beforeedit", this.beforeEdit, this);
}
}
Original comment by marlon...@gmail.com
on 8 Dec 2011 at 1:07
// Fix for events keyboard in chrome/iron - webkit
Ext.form.HtmlEditor.prototype.initEditor=function(){
var dbody = this.getEditorBody();
var ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat');
ss['background-attachment'] = 'fixed'; // w3c
dbody.bgProperties = 'fixed'; // ie
Ext.DomHelper.applyStyles(dbody, ss);
Ext.EventManager.on(this.doc, {
'mousedown': this.onEditorEvent,
'dblclick': this.onEditorEvent,
'click': this.onEditorEvent,
'keyup': this.onEditorEvent,
buffer:100,
scope: this
});
if(Ext.isGecko){
Ext.EventManager.on(this.doc, 'keypress', this.applyCommand, this);
}
if(Ext.isIE || Ext.isWebKit || Ext.isOpera){
Ext.EventManager.on(this.doc, 'keydown', this.fixKeys, this);
}
this.initialized = true;
this.fireEvent('initialize', this);
this.pushValue();
};
Ext.form.HtmlEditor.prototype.fixKeys=function(){
if(Ext.isIE){
return function(e){
var k = e.getKey(), r;
if(k == e.TAB){
e.stopEvent();
r = this.doc.selection.createRange();
if(r){
r.collapse(true);
r.pasteHTML(' ');
this.deferFocus();
}
}else if(k == e.ENTER){
r = this.doc.selection.createRange();
if(r){
var target = r.parentElement();
if(!target || target.tagName.toLowerCase() != 'li'){
e.stopEvent();
r.pasteHTML('<br />');
r.collapse(false);
r.select();
}
}
}
};
}else if(Ext.isOpera){
return function(e){
var k = e.getKey();
if(k == e.TAB){
e.stopEvent();
this.win.focus();
this.execCmd('InsertHTML',' ');
this.deferFocus();
}
};
}else if(Ext.isWebKit){
return function(e){
var k = e.getKey();
if(k == e.TAB){
e.stopEvent();
this.execCmd('InsertText','\t');
this.deferFocus();
} else if (k == e.ENTER) {
e.stopEvent();
me.execCmd('InsertHtml','<br/><br/>');
me.deferFocus();
}
};
}
}();
Original comment by marlon...@gmail.com
on 8 Dec 2011 at 1:13
Original issue reported on code.google.com by
marlon...@gmail.com
on 7 Dec 2011 at 7:18