Guest User

Untitled

a guest
Jan 21st, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. Ext.onReady(function() {
  2. // Context Menu
  3. var menu = Ext.create('Ext.menu.Menu', {
  4. items : [{
  5. text : 'Copy',
  6. handler : function() {
  7. // Selection is not available here
  8. console.log("On Context menu item:" + window.getSelection().toString());
  9.  
  10. }
  11. }],
  12. listeners : {
  13. mouseenter : function() {
  14. // Selection is not available here
  15. console.log("Enter menu render: " + window.getSelection().toString());
  16. },
  17. activate : function () {
  18. // Selection is still available
  19. console.log("Activate Context menu render:" + window.getSelection().toString());
  20. }
  21. }
  22. });
  23.  
  24. // Bind to contextmenu event listener
  25. Ext.getDoc().on('contextmenu', function(ev) {
  26. menu.showAt(ev.getXY());
  27. ev.stopEvent();
  28. // Selection is available
  29. console.log("On Context menu :" + window.getSelection().toString());
  30. });
  31. });
Add Comment
Please, Sign In to add comment