-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b20afc1
Showing
5 changed files
with
1,964 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/ | ||
polar-web/ | ||
dist/ | ||
.DS_Store |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,81 @@ | ||
const electron = require('electron'); | ||
const path = require('path'); | ||
const url = require('url'); | ||
const { Menu } = electron; | ||
const { app } = electron; | ||
const { BrowserWindow } = electron; | ||
|
||
let mainWindow; | ||
|
||
const LOAD_URL = url.format({ | ||
pathname: path.join(__dirname, '/polar-web/build/index.html'), | ||
protocol: 'file:', | ||
slashes: true, | ||
}); | ||
|
||
function createWindow() { | ||
mainWindow = new BrowserWindow({ | ||
title: 'Polar', | ||
backgroundColor: '#FCF6E5', | ||
titleBarStyle: 'hiddenInset', | ||
webPreferences: { | ||
webSecurity: false, | ||
nativeWindowOpen: true, | ||
nodeIntegration: true, | ||
enableRemoteModule: true, | ||
}, | ||
}); | ||
|
||
mainWindow.webContents.openDevTools(); | ||
|
||
mainWindow.loadURL(LOAD_URL); | ||
|
||
const menu = Menu.buildFromTemplate([ | ||
{ | ||
label: 'Polar', | ||
submenu: [ | ||
{ | ||
label: 'Thoát ứng dụng', | ||
role: 'quit', | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'Edit', | ||
submenu: [ | ||
{ label: 'Undo', accelerator: 'CmdOrCtrl+Z', selector: 'undo:' }, | ||
{ label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', selector: 'redo:' }, | ||
{ type: 'separator' }, | ||
{ label: 'Cut', accelerator: 'CmdOrCtrl+X', selector: 'cut:' }, | ||
{ label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:' }, | ||
{ label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:' }, | ||
{ | ||
label: 'Select All', | ||
accelerator: 'CmdOrCtrl+A', | ||
selector: 'selectAll:', | ||
}, | ||
], | ||
}, | ||
]); | ||
Menu.setApplicationMenu(menu); | ||
|
||
mainWindow.on('closed', () => { | ||
mainWindow = null; | ||
}); | ||
} | ||
|
||
app.on('ready', () => { | ||
createWindow(); | ||
}); | ||
|
||
app.on('window-all-closed', () => { | ||
if (process.platform !== 'darwin') { | ||
app.quit(); | ||
} | ||
}); | ||
|
||
app.on('activate', () => { | ||
if (mainWindow === null) { | ||
createWindow(); | ||
} | ||
}); |
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,51 @@ | ||
{ | ||
"name": "polar-desktop", | ||
"version": "1.0.0", | ||
"main": "main.js", | ||
"license": "MIT", | ||
"scripts": { | ||
"react-build": "rm -rf polar-web && git clone https://github.com/polar-write/polar-web.git && cd polar-web && yarn && yarn build && cd ..", | ||
"build": "yarn react-build && yarn dist:mac && yarn dist:win", | ||
"dist:mac": "electron-builder --mac", | ||
"dist:win": "electron-builder --win --x64 --ia32", | ||
"prebuild": "rm -rf ./polar-web/build && rm -rf ./dist", | ||
"postinstall": "electron-builder install-app-deps" | ||
}, | ||
"homepage": "./", | ||
"build": { | ||
"appId": "com.quocs.polar", | ||
"productName": "Polar", | ||
"copyright": "Copyright © 2021 Quocs Studio", | ||
"mac": { | ||
"category": "public.app-category.productivity", | ||
"target": "dmg", | ||
"icon": "assets/images/logo.png" | ||
}, | ||
"win": { | ||
"target": "nsis", | ||
"icon": "assets/images/logo.png" | ||
}, | ||
"nsis": { | ||
"oneClick": false, | ||
"allowToChangeInstallationDirectory": true | ||
}, | ||
"extends": null, | ||
"files": [ | ||
"./polar-web/build/**/*", | ||
"./polar-web/node_modules/**/*", | ||
"./polar-web/src/**/*", | ||
"./polar-web/public/*", | ||
"./assets/images/*", | ||
"./main.js" | ||
], | ||
"directories": { | ||
"buildResources": "public" | ||
} | ||
}, | ||
"devDependencies": { | ||
"concurrently": "^5.3.0", | ||
"electron": "^11.2.3", | ||
"electron-builder": "^22.9.1", | ||
"wait-on": "^5.2.1" | ||
} | ||
} |
Oops, something went wrong.