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

added OS in process.platform for web app

parent 9d4ffeb4
"use strict"; "use strict";
var is_webapp = typeof process === "undefined";
var is_mac = is_webapp ? navigator.platform.toUpperCase().indexOf("MAC") > -1 : process.platform === "darwin";
var cmd_or_ctrl = is_mac ? "Cmd" : "Ctrl"; var cmd_or_ctrl = is_mac ? "Cmd" : "Ctrl";
exports.menu = { exports.menu = {
"new": { key: "N", modifiers: cmd_or_ctrl }, "new": { key: "N", modifiers: cmd_or_ctrl },
"open": { key: "O", modifiers: cmd_or_ctrl }, "open": { key: "O", modifiers: cmd_or_ctrl },
...@@ -98,7 +95,7 @@ exports.menu = { ...@@ -98,7 +95,7 @@ exports.menu = {
"find_web": { key: "F", modifiers: cmd_or_ctrl }, "find_web": { key: "F", modifiers: cmd_or_ctrl },
"findagain_web":{ key: "F", modifiers: cmd_or_ctrl + "+Shift"}, "findagain_web":{ key: "F", modifiers: cmd_or_ctrl + "+Shift"},
"editmode_web": { key: "E", modifiers: cmd_or_ctrl + "+Shift" }, "editmode_web": { key: "E", modifiers: cmd_or_ctrl + "+Shift" },
"preferences_web": { key: (is_mac) ? "," : "P", "preferences_web": { key: (process.platform === "darwin") ? "," : "P",
modifiers: cmd_or_ctrl }, modifiers: cmd_or_ctrl },
"zoomin_web": { key: "=", modifiers: cmd_or_ctrl }, "zoomin_web": { key: "=", modifiers: cmd_or_ctrl },
...@@ -107,8 +104,8 @@ exports.menu = { ...@@ -107,8 +104,8 @@ exports.menu = {
"zoomoptimal_web": { key: "9", modifiers: cmd_or_ctrl }, "zoomoptimal_web": { key: "9", modifiers: cmd_or_ctrl },
"zoomhoriz_web": { key: "9", modifiers: cmd_or_ctrl }, "zoomhoriz_web": { key: "9", modifiers: cmd_or_ctrl },
"zoomvert_web": { key: "9", modifiers: cmd_or_ctrl + "+Shift" }, "zoomvert_web": { key: "9", modifiers: cmd_or_ctrl + "+Shift" },
"fullscreen_web": { key: (is_mac) ? "F" : "F11", "fullscreen_web": { key: (process.platform === "darwin") ? "F" : "F11",
modifiers: (is_mac) ? "Cmd+Ctrl" : null }, modifiers: (process.platform === "darwin") ? "Cmd+Ctrl" : null },
"object_web": { key: "1", modifiers: cmd_or_ctrl }, "object_web": { key: "1", modifiers: cmd_or_ctrl },
"msgbox_web": { key: "2", modifiers: cmd_or_ctrl }, "msgbox_web": { key: "2", modifiers: cmd_or_ctrl },
......
...@@ -12,6 +12,13 @@ function is_webapp(){ ...@@ -12,6 +12,13 @@ function is_webapp(){
exports.is_webapp = is_webapp; exports.is_webapp = is_webapp;
if (is_webapp()) {
if (navigator.platform.toUpperCase().indexOf("MAC") > -1) {
process.platform = "darwin";
} else if (navigator.platform.toUpperCase().indexOf("WIN") > -1) {
process.platform = "win32";
}
}
exports.set_pwd = function(pwd_string) { exports.set_pwd = function(pwd_string) {
pwd = pwd_string; pwd = pwd_string;
......
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