mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-15 11:07:57 +01:00
Fix some browser issues
This commit is contained in:
parent
1d0d907284
commit
46d56528de
@ -256,13 +256,23 @@ mindplot.DesignerKeyboard = new Class({
|
||||
event.stopPropagation();
|
||||
}
|
||||
);
|
||||
var excludes = ['esc', 'f1', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12'];
|
||||
|
||||
$(document).on('keypress', function (event) {
|
||||
|
||||
var keyCode = event.keyCode;
|
||||
var keyCode;
|
||||
// Firefox doesn't skip special keys for keypress event...
|
||||
if (event.key && excludes.contains(event.key.toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
// Sometimes Firefox doesn't contain keyCode value
|
||||
if (event.key && event.keyCode == 0) {
|
||||
keyCode = event.charCode;
|
||||
} else {
|
||||
keyCode = event.keyCode;
|
||||
}
|
||||
|
||||
var specialKey = jQuery.hotkeys.specialKeys[keyCode];
|
||||
if (["enter", "capslock"].indexOf(specialKey) == -1 && !jQuery.hotkeys.shiftNums[keyCode] && keyCode != 91 /*win key*/) {
|
||||
if (["enter", "capslock"].indexOf(specialKey) == -1 && !jQuery.hotkeys.shiftNums[keyCode]) {
|
||||
var nodes = designer.getModel().filterSelectedTopics();
|
||||
if (nodes.length > 0) {
|
||||
|
||||
@ -379,3 +389,14 @@ mindplot.DesignerKeyboard = new Class({
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
mindplot.DesignerKeyboard.specialKeys = {
|
||||
8: "backspace", 9: "tab", 10: "return", 13: "enter", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
|
||||
20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
|
||||
37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
|
||||
96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
|
||||
104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
|
||||
112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
|
||||
120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 186: ";", 191: "/",
|
||||
220: "\\", 222: "'", 224: "meta"
|
||||
};
|
Loading…
Reference in New Issue
Block a user