selection and context menu

what happens when i try to use context menu and selection?

by Litote0707

HTML

<link rel="stylesheet" href="http://dev.sencha.com/deploy/ext-4.0.2a/resources/css/ext-all.css">
just some text

JavaScript

Ext.onReady(function() {
    // Context Menu
    var menu = Ext.create('Ext.menu.Menu', {
        renderTo: Ext.getBody(),
        items: [{
            text: 'Copy',
            handler: function() {
                // Selection is not available here
                alert("On Context menu item:" + window.getSelection().toString());

            }}],
        listeners: {
            mouseenter: function() {
                // Selection is not available here
                //alert("Enter menu render: " + window.getSelection().toString());
            },
            activate: function() {
                // Selection is still available
                alert("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
        alert("On Context menu :" + window.getSelection().toString());
    });
});