Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit eb51e6c

Browse files
authored
Merge pull request #62 from ZeroX-DG/auto-complete-tag
Support tag completion with Enter key
2 parents 36da556 + 042e84e commit eb51e6c

File tree

5 files changed

+210
-208
lines changed

5 files changed

+210
-208
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
language: node_js
22
node_js:
3-
- 7
3+
- 13
44
before_script:
55
- npm install -g jest
66
script:
77
- npm run lint && npm run test
88
sudo: required
99
cache:
1010
directories:
11-
- node_modules
11+
- node_modules

app/app-main.js

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
const { app, Menu, ipcMain } = require("electron");
1+
const { app, Menu, ipcMain } = require('electron')
22

3-
let mainWindow = null;
3+
let mainWindow = null
44

5-
const gotTheLock = app.requestSingleInstanceLock();
5+
const gotTheLock = app.requestSingleInstanceLock()
66

77
if (!gotTheLock) {
8-
app.quit();
8+
app.quit()
99
} else {
10-
app.on("second-instance", (event, commandLine, workingDirectory) => {
10+
app.on('second-instance', (event, commandLine, workingDirectory) => {
1111
if (mainWindow) {
12-
if (process.platform === "win32") {
13-
mainWindow.minimize();
14-
mainWindow.restore();
12+
if (process.platform === 'win32') {
13+
mainWindow.minimize()
14+
mainWindow.restore()
1515
}
16-
mainWindow.show();
17-
mainWindow.focus();
16+
mainWindow.show()
17+
mainWindow.focus()
1818
}
19-
});
19+
})
2020

21-
app.on("ready", () => {
22-
mainWindow = require("./app-window")(app);
23-
require("./app-tray")(app, mainWindow);
24-
ipcMain.on("bringToFront", () => {
25-
if (process.platform === "win32") {
26-
mainWindow.minimize();
27-
mainWindow.restore();
21+
app.on('ready', () => {
22+
mainWindow = require('./app-window')(app)
23+
require('./app-tray')(app, mainWindow)
24+
ipcMain.on('bringToFront', () => {
25+
if (process.platform === 'win32') {
26+
mainWindow.minimize()
27+
mainWindow.restore()
2828
}
29-
mainWindow.show();
30-
mainWindow.focus();
31-
});
32-
const template = require("./app-menu")(app, mainWindow);
33-
const menu = Menu.buildFromTemplate(template);
29+
mainWindow.show()
30+
mainWindow.focus()
31+
})
32+
const template = require('./app-menu')(app, mainWindow)
33+
const menu = Menu.buildFromTemplate(template)
3434
switch (process.platform) {
35-
case "darwin":
36-
Menu.setApplicationMenu(menu);
37-
break;
38-
case "win32":
39-
mainWindow.setMenu(menu);
40-
break;
41-
case "linux":
42-
Menu.setApplicationMenu(menu);
43-
mainWindow.setMenu(menu);
44-
break;
35+
case 'darwin':
36+
Menu.setApplicationMenu(menu)
37+
break
38+
case 'win32':
39+
mainWindow.setMenu(menu)
40+
break
41+
case 'linux':
42+
Menu.setApplicationMenu(menu)
43+
mainWindow.setMenu(menu)
44+
break
4545
}
46-
});
46+
})
4747

48-
app.on("before-quit", () => {
49-
mainWindow.shouldQuit();
50-
});
48+
app.on('before-quit', () => {
49+
mainWindow.shouldQuit()
50+
})
5151
}

app/app-window.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
const electron = require("electron");
2-
const BrowserWindow = electron.BrowserWindow;
3-
const path = require("path");
4-
const Store = require("electron-store");
5-
const store = new Store();
6-
const _ = require("lodash");
1+
const electron = require('electron')
2+
const BrowserWindow = electron.BrowserWindow
3+
const path = require('path')
4+
const Store = require('electron-store')
5+
const store = new Store()
6+
const _ = require('lodash')
77

8-
const showMenu = process.platform !== "win32";
9-
const windowSize = store.get("windowsize") || { width: 1080, height: 720 };
10-
let mainWindow = null;
11-
let isQuitting = false;
8+
const showMenu = process.platform !== 'win32'
9+
const windowSize = store.get('windowsize') || { width: 1080, height: 720 }
10+
let mainWindow = null
11+
let isQuitting = false
1212

13-
function createWindow(app) {
13+
function createWindow (app) {
1414
mainWindow = new BrowserWindow({
1515
width: windowSize.width,
1616
height: windowSize.height,
@@ -20,49 +20,49 @@ function createWindow(app) {
2020
webPreferences: {
2121
zoomFactor: 1.0,
2222
nodeIntegration: true,
23-
blinkFeatures: "OverlayScrollbars"
23+
blinkFeatures: 'OverlayScrollbars'
2424
},
25-
icon: path.resolve(__dirname, "../resources/icon/icon512.png")
26-
});
25+
icon: path.resolve(__dirname, '../resources/icon/icon512.png')
26+
})
2727

28-
const url = "file://" + path.resolve(__dirname, "./index.html");
28+
const url = 'file://' + path.resolve(__dirname, './index.html')
2929

30-
mainWindow.loadURL(url);
31-
mainWindow.on("resize", _.throttle(storeWindowSize, 500));
32-
if (process.env.NODE_ENV === "dev") {
33-
mainWindow.webContents.openDevTools();
30+
mainWindow.loadURL(url)
31+
mainWindow.on('resize', _.throttle(storeWindowSize, 500))
32+
if (process.env.NODE_ENV === 'dev') {
33+
mainWindow.webContents.openDevTools()
3434
}
35-
const screen = electron.screen.getPrimaryDisplay();
35+
const screen = electron.screen.getPrimaryDisplay()
3636
if (
3737
windowSize.width >= screen.size.width &&
3838
windowSize.height >= screen.size.height - 1
3939
) {
40-
mainWindow.maximize();
40+
mainWindow.maximize()
4141
}
4242
// prevent the app from quitting
43-
mainWindow.on("close", e => {
43+
mainWindow.on('close', e => {
4444
if (!isQuitting) {
45-
e.preventDefault();
46-
mainWindow.blur();
47-
if (process.platform === "darwin") {
48-
app.hide();
45+
e.preventDefault()
46+
mainWindow.blur()
47+
if (process.platform === 'darwin') {
48+
app.hide()
4949
} else {
50-
mainWindow.hide();
50+
mainWindow.hide()
5151
}
5252
}
53-
});
53+
})
5454

55-
mainWindow.shouldQuit = function() {
56-
isQuitting = true;
57-
};
55+
mainWindow.shouldQuit = function () {
56+
isQuitting = true
57+
}
5858

59-
return mainWindow;
59+
return mainWindow
6060
}
6161

62-
function storeWindowSize() {
62+
function storeWindowSize () {
6363
try {
64-
store.set("windowsize", mainWindow.getBounds());
64+
store.set('windowsize', mainWindow.getBounds())
6565
} catch (e) {}
6666
}
6767

68-
module.exports = createWindow;
68+
module.exports = createWindow

0 commit comments

Comments
 (0)