As you can see in the picture that if i click the selected tab "Navigation" then only the rename option is appearing (pic 2). I want to make this via key board.
JavaScript code:
_makeEditable: function() {
var instance = this;
if (instance._isModifiable) {
var currentItem = instance._navBlock.find('li.selected');
var currentLink = currentItem.find('a');
var currentSpan = curren开发者_如何学CtLink.find('span');
currentLink.click(
function(event) {
if (event.shiftKey) {
return false;
}
}
);
You might want to try something like this:
prototype.js:
document.observe('keydown', mainWindowKeyDown);
jquery (not sure about this, I don't use jquery often):
$(function()
{
$(document).keydown(mainWindowKeyDown);
});
The keydown handler could be something like:
/*
Called when hitting any key.
*/
function mainWindowKeyDown(e)
{
if (e.keyCode == 113) // when F2 is pressed
triggerTabRename();
//else if (e.ctrlKey && e.keyCode == 90) // when ctrl + 'z' pressed
// doSomethingWhenCtrlZWasPressed(e);
//else if (e.ctrlKey && e.keyCode == 88) // when ctrl + 'x' pressed
// doSomethingWhenCtrlXWasPressed(e);
}
Here you can find a list of keycodes.
精彩评论