Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #8 from zaggino/marcel/multiple-fixes
Browse files Browse the repository at this point in the history
Multiple fixes
  • Loading branch information
zaggino committed May 4, 2015
2 parents ac2f9ad + 682963c commit dd03045
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 44 deletions.
19 changes: 8 additions & 11 deletions app/appshell/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var path = require("path");
var utils = require("../utils");

var remote = require("remote");
var electronApp = remote.require("app");
var Menu = remote.require("menu");

var menuTemplate = [];
Expand Down Expand Up @@ -78,6 +79,7 @@ function _fixBracketsKeyboardShortcut(shortcut) {
}

shortcut = shortcut.replace(/-/g, "+");
shortcut = shortcut.replace(/\+$/g, "Plus");
shortcut = shortcut.replace(/\u2190/g, "Left");
shortcut = shortcut.replace(/\u2191/g, "Up");
shortcut = shortcut.replace(/\u2192/g, "Right");
Expand Down Expand Up @@ -162,17 +164,8 @@ app.dragWindow = function () {
};

app.getApplicationSupportDirectory = function () {
// TODO: once stable, rename folderName to Brackets
var folderName = "Brackets-electron-dev";
if (process.platform === "win32") {
return utils.convertWindowsPathToUnixPath(path.resolve(process.env.APPDATA, folderName));
} else if (process.platform === "linux") {
return path.resolve("/home/", process.env.USER, ".config", folderName);
} else if (process.platform === "darwin") {
return path.resolve("/Users/", process.env.USER, "Library", "Application Support", folderName);
} else {
throw new Error("getApplicationSupportDirectory() not implemented for platform " + process.platform);
}
// TODO: once stable, change "productName" to Brackets in package.json
return utils.convertWindowsPathToUnixPath(electronApp.getPath("userData"));
};

app.getDroppedFiles = function (callback) {
Expand Down Expand Up @@ -270,6 +263,10 @@ app.setMenuItemState = function (commandId, enabled, checked, callback) {
var obj = _findMenuItemById(commandId);
obj.enabled = enabled;
obj.checked = checked;
if (checked) {
// TODO: Change addMenuItem to set the type (checkbox, radio, ... submenu)
obj.type = "checkbox";
}
_refreshMenu(callback);
};

Expand Down
5 changes: 5 additions & 0 deletions app/appshell/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ function showOpenDialog(allowMultipleSelection, chooseDirectory, title, initialP
properties.push("multiSelections");
}

// TODO: I don't think defaultPath and filters work right now - we should test that
// Also, it doesn't return an error code on failure any more (and doesn't pass one to the callback as well)
return dialog.showOpenDialog({
title: title,
defaultPath: initialPath,
Expand All @@ -72,6 +74,9 @@ function showOpenDialog(allowMultipleSelection, chooseDirectory, title, initialP
}

function showSaveDialog(title, initialPath, proposedNewFilename, callback) {
// TODO: Implement proposedNewFilename
// TODO: I don't think defaultPath works right now - we should test that
// Also, it doesn't return an error code on failure any more (and doesn't pass one to the callback as well)
return dialog.showSaveDialog({
title: title,
defaultPath: initialPath
Expand Down
12 changes: 7 additions & 5 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ app.on("ready", function () {

// build a query for brackets' window
var queryParams = {
hasNativeMenus: true
};
var query = "?" + _.map(queryParams, function (value, key) {
return key + "=" + encodeURIComponent(value);
}).join("&");
},
query = "";
if (Object.keys(queryParams).length > 0) { // check if queryParams is empty
query = "?" + _.map(queryParams, function (value, key) {
return key + "=" + encodeURIComponent(value);
}).join("&");
}

// compose path to brackets' index file
var indexPath = "file://" + path.resolve(__dirname, "..", "src", "index.html") + query;
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Brackets",
"productName": "Brackets-Electron-dev",
"version": "1.3.0-0",
"apiVersion": "1.3.0",
"homepage": "http://brackets.io",
Expand Down Expand Up @@ -51,10 +52,11 @@
"bin": {
"brackets": "./app/index.js"
},
"main": "./app/index.js",
"scripts": {
"postinstall": "grunt install",
"test": "grunt cla-check-pull test",
"start": "electron ./app/index.js"
"start": "electron ."
},
"licenses": [
{
Expand Down
24 changes: 0 additions & 24 deletions src/brackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,30 +426,6 @@ define(function (require, exports, module) {
}
}, true);

// on Windows, cancel every other scroll event (#10214)
// TODO: remove this hack when we upgrade CEF to a build with this bug fixed:
// https://bitbucket.org/chromiumembedded/cef/issue/1481
var winCancelWheelEvent = true;
function windowsScrollFix(e) {
winCancelWheelEvent = !winCancelWheelEvent;
if (winCancelWheelEvent) {
e.preventDefault();
e.stopImmediatePropagation();
}
}

function enableOrDisableWinScrollFix() {
window.document.body.removeEventListener("wheel", windowsScrollFix, true);
if (PreferencesManager.get("_windowsScrollFix")) {
window.document.body.addEventListener("wheel", windowsScrollFix, true);
}
}

if (brackets.platform === "win" && !brackets.inBrowser) {
PreferencesManager.definePreference("_windowsScrollFix", "boolean", true).on("change", enableOrDisableWinScrollFix);
enableOrDisableWinScrollFix();
}

// Prevent extensions from using window.open() to insecurely load untrusted web content
var real_windowOpen = window.open;
window.open = function (url) {
Expand Down
18 changes: 16 additions & 2 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
"extension_url": "https://s3.amazonaws.com/extend.brackets/{0}/{0}-{1}.zip",
"linting.enabled_by_default": true,
"build_timestamp": "",
"healthDataServerURL" : "http://healthdev.brackets.io/healthDataLog"
"healthDataServerURL": "https://health.brackets.io/healthDataLog"
},
"name": "Brackets",
"productName": "Brackets-Electron-dev",
"version": "1.3.0-0",
"apiVersion": "1.3.0",
"homepage": "http://brackets.io",
Expand All @@ -35,7 +36,15 @@
"branch": "",
"SHA": ""
},
"dependencies": {
"bluebird": "2.9.25",
"fs-extra": "0.18.2",
"lodash": "3.8.0",
"trash": "1.4.1",
"ws": "0.7.1"
},
"devDependencies": {
"electron-prebuilt": "0.25.2",
"grunt": "0.4.1",
"jasmine-node": "1.11.0",
"grunt-jasmine-node": "0.1.0",
Expand Down Expand Up @@ -63,9 +72,14 @@
"xmldoc": "^0.1.2",
"grunt-cleanempty": "1.0.3"
},
"bin": {
"brackets": "./app/index.js"
},
"main": "./app/index.js",
"scripts": {
"postinstall": "grunt install",
"test": "grunt cla-check-pull test"
"test": "grunt cla-check-pull test",
"start": "electron ."
},
"licenses": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/utils/Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ define(function (require, exports, module) {
if (hasNativeMenus) {
global.brackets.nativeMenus = (hasNativeMenus === "true");
} else {
global.brackets.nativeMenus = (!global.brackets.inBrowser && (global.brackets.platform !== "linux"));
global.brackets.nativeMenus = !global.brackets.inBrowser;
}

// Locale-related APIs
Expand Down

0 comments on commit dd03045

Please sign in to comment.