This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add commands-main and execCommand in the main process
commands-main contains commands which are available in the main process to use when no window open (OSX).
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Abricotine - Markdown Editor | ||
* Copyright (c) 2015 Thomas Brouard | ||
* Licensed under GNU-GPLv3 <http://www.gnu.org/licenses/gpl.html> | ||
*/ | ||
|
||
var app = require("app"), | ||
dialogs = require("./dialogs.js"), | ||
constants = require("./constants.js"), | ||
shell = require("shell"); | ||
|
||
// Commands used in the main process (for OSX menu when no opened windows) | ||
var commands = { | ||
new: function (abrApp) { | ||
abrApp.open(); | ||
}, | ||
|
||
open: function (abrApp) { | ||
var path = dialogs.askOpenPath(); | ||
if (!path) { | ||
return false; | ||
} | ||
abrApp.open(path); | ||
}, | ||
|
||
quit: function (abrApp) { | ||
app.quit(); | ||
}, | ||
|
||
editConfigFile: function (abrApp) { | ||
var dirPath = constants.path.userConfig; | ||
shell.openItem(dirPath); | ||
}, | ||
|
||
openConfigDir: function (abrApp) { | ||
var dirPath = constants.path.userData; | ||
shell.openItem(dirPath); | ||
}, | ||
|
||
about: function (abrApp) { | ||
dialogs.about(); | ||
}, | ||
|
||
homepage: function (win, abrDoc, cm) { | ||
var homepageURL = constants.homepageURL; | ||
shell.openExternal(homepageURL); | ||
} | ||
}; | ||
|
||
module.exports = commands; |