I am working on a Sharepoint hosted app, and reassigning some of the keys and key combinations to my custom functions. Here's the fragment of my JavaScript code that does the reassignments:
containerElement = $("#myDiv").length;
if (containerElement) {
// handle alt key combinations
if (e.altKey) {
e.preventDefault();
if (window.event) {
keycode = window.event.keyCode;
} else if (e) {
keycode = e.which;
}
// copy the current window object event
var e = e || window.event;
/* ALT-V */
if (keycode == 86 && e.altKey) {
var pMode = $("#PageMode").val();
if (pMode === "Edit") {
alert("in edit");
} else {
alert("NOT in edit");
}
}
}
}
I thought I was catching the whole ALT-A combination but after the alert popup is closed the browser is opening the ribbon's drop down menu for 'View'. Is there a method either programmatically or by some policy etc. to temporarily disable the hotkeys/shortcuts that Sharepoint have assigned to the keys that I want to use, or even maybe all of them?
Any idea is appreciated

0 commentaires:
Enregistrer un commentaire