|
|
@ -20,10 +20,12 @@ class Ation { |
|
|
|
mainMenu; |
|
|
|
mainMenu; |
|
|
|
watcher; |
|
|
|
watcher; |
|
|
|
currentFile; |
|
|
|
currentFile; |
|
|
|
|
|
|
|
fileToOpen; |
|
|
|
|
|
|
|
|
|
|
|
constructor() { |
|
|
|
constructor() { |
|
|
|
if (Ation.Instances > 0) |
|
|
|
if (Ation.Instances > 0) |
|
|
|
throw new Error("Only one Instance of Ation possible"); |
|
|
|
throw new Error("Only one Instance of Ation possible"); |
|
|
|
|
|
|
|
this.fileToOpen = null; |
|
|
|
this.currentFile = ""; |
|
|
|
this.currentFile = ""; |
|
|
|
this.watcher = null; |
|
|
|
this.watcher = null; |
|
|
|
this.windowManager = new WindowManager(this); |
|
|
|
this.windowManager = new WindowManager(this); |
|
|
@ -31,16 +33,24 @@ class Ation { |
|
|
|
this.settingsManager = new SettingsManager(this); |
|
|
|
this.settingsManager = new SettingsManager(this); |
|
|
|
this.mainMenu = new MainMenu(this); |
|
|
|
this.mainMenu = new MainMenu(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ipcMain.handle("Ation::appVersion", () => AppInfo.version); |
|
|
|
|
|
|
|
ipcMain.on("Ation::closeFile", () => this.closeFile()); |
|
|
|
|
|
|
|
|
|
|
|
app.on("open-file", (_, path) => { |
|
|
|
app.on("open-file", (_, path) => { |
|
|
|
this.fileToOpen = path; |
|
|
|
this.fileToOpen = path; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
ipcMain.handle("Ation::appVersion", () => AppInfo.version); |
|
|
|
|
|
|
|
ipcMain.on("Ation::closeFile", () => this.closeFile()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.whenReady().then(async () => { |
|
|
|
app.whenReady().then(async () => { |
|
|
|
this.settingsManager.change(); |
|
|
|
this.settingsManager.change(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this is a hack for windows, because they do not send the
|
|
|
|
|
|
|
|
// `open-file` event, but pass a "cli parameter" as second
|
|
|
|
|
|
|
|
// argument
|
|
|
|
|
|
|
|
if (!this.fileToOpen) { |
|
|
|
|
|
|
|
if (process.argv.length >= 2) |
|
|
|
|
|
|
|
this.fileToOpen = process.argv[1]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.fileToOpen) |
|
|
|
if (this.fileToOpen) |
|
|
|
this.openFile(this.fileToOpen); |
|
|
|
this.openFile(this.fileToOpen); |
|
|
|
protocol.registerFileProtocol("slideimg", (request, callback) => { |
|
|
|
protocol.registerFileProtocol("slideimg", (request, callback) => { |
|
|
@ -64,7 +74,7 @@ class Ation { |
|
|
|
filters : [ |
|
|
|
filters : [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
name : "Markdown files", |
|
|
|
name : "Markdown files", |
|
|
|
extensions : [".md"] |
|
|
|
extensions : ["md"] |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|
}); |
|
|
|
}); |
|
|
|