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

Commit

Permalink
Merge pull request #62 from ZeroX-DG/auto-complete-tag
Browse files Browse the repository at this point in the history
Support tag completion with Enter key
  • Loading branch information
ZeroX-DG authored Sep 2, 2020
2 parents 36da556 + 042e84e commit eb51e6c
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 208 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: node_js
node_js:
- 7
- 13
before_script:
- npm install -g jest
script:
- npm run lint && npm run test
sudo: required
cache:
directories:
- node_modules
- node_modules
74 changes: 37 additions & 37 deletions app/app-main.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
const { app, Menu, ipcMain } = require("electron");
const { app, Menu, ipcMain } = require('electron')

let mainWindow = null;
let mainWindow = null

const gotTheLock = app.requestSingleInstanceLock();
const gotTheLock = app.requestSingleInstanceLock()

if (!gotTheLock) {
app.quit();
app.quit()
} else {
app.on("second-instance", (event, commandLine, workingDirectory) => {
app.on('second-instance', (event, commandLine, workingDirectory) => {
if (mainWindow) {
if (process.platform === "win32") {
mainWindow.minimize();
mainWindow.restore();
if (process.platform === 'win32') {
mainWindow.minimize()
mainWindow.restore()
}
mainWindow.show();
mainWindow.focus();
mainWindow.show()
mainWindow.focus()
}
});
})

app.on("ready", () => {
mainWindow = require("./app-window")(app);
require("./app-tray")(app, mainWindow);
ipcMain.on("bringToFront", () => {
if (process.platform === "win32") {
mainWindow.minimize();
mainWindow.restore();
app.on('ready', () => {
mainWindow = require('./app-window')(app)
require('./app-tray')(app, mainWindow)
ipcMain.on('bringToFront', () => {
if (process.platform === 'win32') {
mainWindow.minimize()
mainWindow.restore()
}
mainWindow.show();
mainWindow.focus();
});
const template = require("./app-menu")(app, mainWindow);
const menu = Menu.buildFromTemplate(template);
mainWindow.show()
mainWindow.focus()
})
const template = require('./app-menu')(app, mainWindow)
const menu = Menu.buildFromTemplate(template)
switch (process.platform) {
case "darwin":
Menu.setApplicationMenu(menu);
break;
case "win32":
mainWindow.setMenu(menu);
break;
case "linux":
Menu.setApplicationMenu(menu);
mainWindow.setMenu(menu);
break;
case 'darwin':
Menu.setApplicationMenu(menu)
break
case 'win32':
mainWindow.setMenu(menu)
break
case 'linux':
Menu.setApplicationMenu(menu)
mainWindow.setMenu(menu)
break
}
});
})

app.on("before-quit", () => {
mainWindow.shouldQuit();
});
app.on('before-quit', () => {
mainWindow.shouldQuit()
})
}
70 changes: 35 additions & 35 deletions app/app-window.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const electron = require("electron");
const BrowserWindow = electron.BrowserWindow;
const path = require("path");
const Store = require("electron-store");
const store = new Store();
const _ = require("lodash");
const electron = require('electron')
const BrowserWindow = electron.BrowserWindow
const path = require('path')
const Store = require('electron-store')
const store = new Store()
const _ = require('lodash')

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

function createWindow(app) {
function createWindow (app) {
mainWindow = new BrowserWindow({
width: windowSize.width,
height: windowSize.height,
Expand All @@ -20,49 +20,49 @@ function createWindow(app) {
webPreferences: {
zoomFactor: 1.0,
nodeIntegration: true,
blinkFeatures: "OverlayScrollbars"
blinkFeatures: 'OverlayScrollbars'
},
icon: path.resolve(__dirname, "../resources/icon/icon512.png")
});
icon: path.resolve(__dirname, '../resources/icon/icon512.png')
})

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

mainWindow.loadURL(url);
mainWindow.on("resize", _.throttle(storeWindowSize, 500));
if (process.env.NODE_ENV === "dev") {
mainWindow.webContents.openDevTools();
mainWindow.loadURL(url)
mainWindow.on('resize', _.throttle(storeWindowSize, 500))
if (process.env.NODE_ENV === 'dev') {
mainWindow.webContents.openDevTools()
}
const screen = electron.screen.getPrimaryDisplay();
const screen = electron.screen.getPrimaryDisplay()
if (
windowSize.width >= screen.size.width &&
windowSize.height >= screen.size.height - 1
) {
mainWindow.maximize();
mainWindow.maximize()
}
// prevent the app from quitting
mainWindow.on("close", e => {
mainWindow.on('close', e => {
if (!isQuitting) {
e.preventDefault();
mainWindow.blur();
if (process.platform === "darwin") {
app.hide();
e.preventDefault()
mainWindow.blur()
if (process.platform === 'darwin') {
app.hide()
} else {
mainWindow.hide();
mainWindow.hide()
}
}
});
})

mainWindow.shouldQuit = function() {
isQuitting = true;
};
mainWindow.shouldQuit = function () {
isQuitting = true
}

return mainWindow;
return mainWindow
}

function storeWindowSize() {
function storeWindowSize () {
try {
store.set("windowsize", mainWindow.getBounds());
store.set('windowsize', mainWindow.getBounds())
} catch (e) {}
}

module.exports = createWindow;
module.exports = createWindow
Loading

0 comments on commit eb51e6c

Please sign in to comment.