PDA

View Full Version : [CLOSED] Extjs 4.0 How to prevent system right click menu forever for htmleditor?



mandardadpe
15 Apr 2013, 9:24 PM
Hi,
I am using htmleditor and want to add right click menu in it. I am able to get context menu, but it doesn't long beyond 1 min . Please tell how can I show it forever.

Below is code used:

var myHandler = function(e){
x = e.browserEvent.clientX;
y = e.browserEvent.clientY;
bodyContextMenu.showAt(e.getXY());
bodyContextMenu.showAt([x,y]);
};
this.cel = Ext.get(this.getEditorBody()) ;
this.cel.on('contextmenu', function(e){
x = e.browserEvent.clientX;
y = e.browserEvent.clientY;
e.stopEvent();
e.preventDefault();
e.stopEvent();

});
var opts = {buffer:1000};

this.cel.on('contextmenu', myHandler , this ,opts);
If I increase buffer size it doen't show right click menu.

*EDIT BY SLEMMON
Tested on 4.2.0
Tested on 4.2.1.760



Ext.tip.QuickTipManager.init(); // enable tooltips
new Ext.panel.Panel({
title: 'HTML Editor',
renderTo: Ext.getBody(),
width: 550,
height: 250,
frame: true,
layout: 'fit',
items: {
xtype: 'htmleditor',
enableColors: false,
enableAlignments: false
, listeners: {
afterrender: function (field) {
var menu = Ext.widget('menu', {
items: [{
text: 'first'
}, {
text: 'second'
}]
});

field.mon(Ext.get(field.getEditorBody()), 'contextmenu', function (e) {
e.preventDefault();
menu.showAt(e.getXY());
});
}
, delay: 50
}
}
});

slemmon
17 Apr 2013, 9:36 AM
Thanks for the report! I have opened a bug in our bug tracker.