Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ext.onReady(function() {
- // Context Menu
- var menu = Ext.create('Ext.menu.Menu', {
- items : [{
- text : 'Copy',
- handler : function() {
- // Selection is not available here
- console.log("On Context menu item:" + window.getSelection().toString());
- }
- }],
- listeners : {
- mouseenter : function() {
- // Selection is not available here
- console.log("Enter menu render: " + window.getSelection().toString());
- },
- activate : function () {
- // Selection is still available
- console.log("Activate Context menu render:" + window.getSelection().toString());
- }
- }
- });
- // Bind to contextmenu event listener
- Ext.getDoc().on('contextmenu', function(ev) {
- menu.showAt(ev.getXY());
- ev.stopEvent();
- // Selection is available
- console.log("On Context menu :" + window.getSelection().toString());
- });
- });
Add Comment
Please, Sign In to add comment