Commit a7d6f2ed authored by Prakhar Agarwal's avatar Prakhar Agarwal 🎯
Browse files

Change shortcuts depending on user's OS

parent a03759fc
......@@ -181,6 +181,7 @@ function add_shortcuts(cid){
shortcut += e.altKey ? "Alt+": "";
// Add key
shortcut += e.key.toUpperCase();
console.log(shortcut);
if(window.shortkeys[cid].hasOwnProperty(shortcut)){
switch(shortcut) {
case "Ctrl+0":
......
"use strict";
var cmd_or_ctrl = (process.platform === "darwin") ? "Cmd" : "Ctrl";
function getOS() {
var platform = window.navigator.platform,
macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'],
os = null;
if (macosPlatforms.indexOf(platform) !== -1) {
os = 'Mac';
}
return os;
}
var cmd_or_ctrl = (getOS() === "Mac") ? "Cmd" : "Ctrl";
exports.menu = {
"new": { key: "N", modifiers: cmd_or_ctrl },
......@@ -71,65 +83,65 @@ exports.menu = {
// Webapp shortcuts
"new_web": { key: "N", modifiers: cmd_or_ctrl + "+Alt"},
"open_web": { key: "O", modifiers: cmd_or_ctrl + "+Alt"},
"save_web": { key: "S", modifiers: cmd_or_ctrl + "+Alt" },
"new_web": { key: "N", modifiers: cmd_or_ctrl },
"open_web": { key: "O", modifiers: cmd_or_ctrl },
"save_web": { key: "S", modifiers: cmd_or_ctrl },
"saveas_web": { key: "S", modifiers: cmd_or_ctrl + "+Shift" },
"print_web": { key: "P", modifiers: cmd_or_ctrl + "+Alt" },
"message_web" : { key: "M", modifiers: cmd_or_ctrl + "+Alt"},
"close_web": { key: "W", modifiers: cmd_or_ctrl + "+Alt" },
"print_web": { key: "P", modifiers: cmd_or_ctrl },
"message_web" : { key: "M", modifiers: cmd_or_ctrl },
"close_web": { key: "W", modifiers: cmd_or_ctrl },
"undo_web": { key: "Z", modifiers: cmd_or_ctrl + "+Alt" },
"redo_web": { key: "Z", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"undo_web": { key: "Z", modifiers: cmd_or_ctrl },
"redo_web": { key: "Z", modifiers: cmd_or_ctrl + "+Shift" },
"selectall_web":{ key: "Q", modifiers: cmd_or_ctrl + "+Shift"},
"cut_web": { key: "X", modifiers: cmd_or_ctrl + "+Shift" },
"copy_web": { key: "C", modifiers: cmd_or_ctrl + "+Alt"},
"paste_web": { key: "V", modifiers: cmd_or_ctrl + "+Alt" },
"paste_clipboard_web": { key: "G", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"duplicate_web": { key: "D", modifiers: cmd_or_ctrl + "+Alt" },
"reselect_web": { key: "Q", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"clear_console_web": { key: "L", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"tidyup_web": { key: "Y", modifiers: cmd_or_ctrl + "+Alt" },
"cordinspector_web": { key: "R", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"find_web": { key: "F", modifiers: cmd_or_ctrl + "+Alt"},
"findagain_web":{ key: "F", modifiers: cmd_or_ctrl + "+Shift+Alt"},
"editmode_web": { key: "E", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"preferences_web": { key: (process.platform === "darwin") ? "," : "P",
"copy_web": { key: "C", modifiers: cmd_or_ctrl },
"paste_web": { key: "V", modifiers: cmd_or_ctrl },
"paste_clipboard_web": { key: "G", modifiers: cmd_or_ctrl + "+Shift" },
"duplicate_web": { key: "D", modifiers: cmd_or_ctrl },
"reselect_web": { key: "Q", modifiers: cmd_or_ctrl + "+Shift" },
"clear_console_web": { key: "L", modifiers: cmd_or_ctrl + "+Shift" },
"tidyup_web": { key: "Y", modifiers: cmd_or_ctrl },
"cordinspector_web": { key: "R", modifiers: cmd_or_ctrl + "+Shift" },
"find_web": { key: "F", modifiers: cmd_or_ctrl },
"findagain_web":{ key: "F", modifiers: cmd_or_ctrl + "+Shift"},
"editmode_web": { key: "E", modifiers: cmd_or_ctrl + "+Shift" },
"preferences_web": { key: (getOS() === "Mac") ? "," : "P",
modifiers: cmd_or_ctrl },
"zoomin_web": { key: "=", modifiers: cmd_or_ctrl },
"zoomout_web": { key: "-", modifiers: cmd_or_ctrl },
"zoomreset_web": { key: "0", modifiers: cmd_or_ctrl },
"zoomoptimal_web": { key: "9", modifiers: cmd_or_ctrl },
"zoomhoriz_web": { key: "9", modifiers: cmd_or_ctrl + "+Alt" },
"zoomhoriz_web": { key: "9", modifiers: cmd_or_ctrl },
"zoomvert_web": { key: "9", modifiers: cmd_or_ctrl + "+Shift" },
"fullscreen_web": { key: (process.platform === "darwin") ? "F" : "F11",
modifiers: (process.platform === "darwin") ? "Cmd+Ctrl" : null },
"object_web": { key: "1", modifiers: cmd_or_ctrl + "+Alt" },
"msgbox_web": { key: "2", modifiers: cmd_or_ctrl + "+Alt" },
"number_web": { key: "3", modifiers: cmd_or_ctrl + "+Alt" },
"symbol_web": { key: "4", modifiers: cmd_or_ctrl + "+Alt" },
"comment_web": { key: "5", modifiers: cmd_or_ctrl + "+Alt" },
"dropdown_web": { key: "M", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"bang_web": { key: "B", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"toggle_web": { key: "T", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"number2_web": { key: "N", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"vslider_web": { key: "V", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"hslider_web": { key: "H", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"vradio_web": { key: "D", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"hradio_web": { key: "I", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"vu_web": { key: "U", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"cnv_web": { key: "C", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"nextwin_web": { key: "PageDown", modifiers: cmd_or_ctrl + "+Alt"},
"prevwin_web": { key: "PageUp", modifiers: cmd_or_ctrl + "+Alt"},
"fullscreen_web": { key: (getOS() === "Mac") ? "F" : "F11",
modifiers: (getOS() === "Mac") ? "Cmd+Ctrl" : null },
"object_web": { key: "1", modifiers: cmd_or_ctrl },
"msgbox_web": { key: "2", modifiers: cmd_or_ctrl },
"number_web": { key: "3", modifiers: cmd_or_ctrl },
"symbol_web": { key: "4", modifiers: cmd_or_ctrl },
"comment_web": { key: "5", modifiers: cmd_or_ctrl },
"dropdown_web": { key: "M", modifiers: cmd_or_ctrl + "+Shift" },
"bang_web": { key: "B", modifiers: cmd_or_ctrl + "+Shift" },
"toggle_web": { key: "T", modifiers: cmd_or_ctrl + "+Shift" },
"number2_web": { key: "N", modifiers: cmd_or_ctrl + "+Shift" },
"vslider_web": { key: "V", modifiers: cmd_or_ctrl + "+Shift" },
"hslider_web": { key: "H", modifiers: cmd_or_ctrl + "+Shift" },
"vradio_web": { key: "D", modifiers: cmd_or_ctrl + "+Shift" },
"hradio_web": { key: "I", modifiers: cmd_or_ctrl + "+Shift" },
"vu_web": { key: "U", modifiers: cmd_or_ctrl + "+Shift" },
"cnv_web": { key: "C", modifiers: cmd_or_ctrl + "+Shift" },
"nextwin_web": { key: "PageDown", modifiers: cmd_or_ctrl },
"prevwin_web": { key: "PageUp", modifiers: cmd_or_ctrl },
"pdwin_web": { key: "R", modifiers: cmd_or_ctrl },
"audio_on_web": { key: "/", modifiers: cmd_or_ctrl + "+Alt"},
"audio_off_web": { key: ".", modifiers: cmd_or_ctrl + "+Alt"},
"audio_on_web": { key: "/", modifiers: cmd_or_ctrl },
"audio_off_web": { key: ".", modifiers: cmd_or_ctrl },
"browser_web": { key: "B", modifiers: cmd_or_ctrl + "+Alt" },
"browser_web": { key: "B", modifiers: cmd_or_ctrl },
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment