1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-23 22:51:42 +00:00

fixed eslint error & integrated with prettier as well as formatted the whole codebase (#3450)

This commit is contained in:
Nguyen Viet Hung
2020-02-05 13:28:27 +13:00
committed by GitHub
parent 051ce9e208
commit 592aca1539
186 changed files with 9233 additions and 5565 deletions

View File

@@ -17,11 +17,11 @@ const electron = require('electron')
const { remote, ipcRenderer } = electron
const { dialog } = remote
document.addEventListener('drop', function (e) {
document.addEventListener('drop', function(e) {
e.preventDefault()
e.stopPropagation()
})
document.addEventListener('dragover', function (e) {
document.addEventListener('dragover', function(e) {
e.preventDefault()
e.stopPropagation()
})
@@ -33,7 +33,7 @@ let isAltWithMouse = false
let isAltWithOtherKey = false
let isOtherKey = false
document.addEventListener('keydown', function (e) {
document.addEventListener('keydown', function(e) {
if (e.key === 'Alt') {
isAltPressing = true
if (isOtherKey) {
@@ -47,13 +47,13 @@ document.addEventListener('keydown', function (e) {
}
})
document.addEventListener('mousedown', function (e) {
document.addEventListener('mousedown', function(e) {
if (isAltPressing) {
isAltWithMouse = true
}
})
document.addEventListener('keyup', function (e) {
document.addEventListener('keyup', function(e) {
if (e.key === 'Alt') {
if (isAltWithMouse || isAltWithOtherKey) {
e.preventDefault()
@@ -65,14 +65,13 @@ document.addEventListener('keyup', function (e) {
}
})
document.addEventListener('click', function (e) {
document.addEventListener('click', function(e) {
const className = e.target.className
if (!className && typeof (className) !== 'string') return
if (!className && typeof className !== 'string') return
const isInfoButton = className.includes('infoButton')
const offsetParent = e.target.offsetParent
const isInfoPanel = offsetParent !== null
? offsetParent.className.includes('infoPanel')
: false
const isInfoPanel =
offsetParent !== null ? offsetParent.className.includes('infoPanel') : false
if (isInfoButton || isInfoPanel) return
const infoPanel = document.querySelector('.infoPanel')
if (infoPanel) infoPanel.style.display = 'none'
@@ -80,11 +79,11 @@ document.addEventListener('click', function (e) {
const el = document.getElementById('content')
function notify (...args) {
function notify(...args) {
return new window.Notification(...args)
}
function updateApp () {
function updateApp() {
const index = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: i18n.__('Update Boostnote'),
@@ -97,7 +96,7 @@ function updateApp () {
}
}
ReactDOM.render((
ReactDOM.render(
<Provider store={store}>
<ConnectedRouter history={history}>
<Fragment>
@@ -112,36 +111,41 @@ ReactDOM.render((
{/* storages */}
<Redirect path='/storages' to='/home' exact />
<Route path='/storages/:storageKey' component={Main} exact />
<Route path='/storages/:storageKey/folders/:folderKey' component={Main} />
<Route
path='/storages/:storageKey/folders/:folderKey'
component={Main}
/>
</Switch>
<DevTools />
</Fragment>
</ConnectedRouter>
</Provider>
), el, function () {
const loadingCover = document.getElementById('loadingCover')
loadingCover.parentNode.removeChild(loadingCover)
</Provider>,
el,
function() {
const loadingCover = document.getElementById('loadingCover')
loadingCover.parentNode.removeChild(loadingCover)
ipcRenderer.on('update-ready', function () {
store.dispatch({
type: 'UPDATE_AVAILABLE'
ipcRenderer.on('update-ready', function() {
store.dispatch({
type: 'UPDATE_AVAILABLE'
})
notify('Update ready!', {
body: 'New Boostnote is ready to be installed.'
})
updateApp()
})
notify('Update ready!', {
body: 'New Boostnote is ready to be installed.'
})
updateApp()
})
ipcRenderer.on('update-found', function () {
notify('Update found!', {
body: 'Preparing to update...'
ipcRenderer.on('update-found', function() {
notify('Update found!', {
body: 'Preparing to update...'
})
})
})
ipcRenderer.send('update-check', 'check-update')
window.addEventListener('online', function () {
if (!store.getState().status.updateReady) {
ipcRenderer.send('update-check', 'check-update')
}
})
})
ipcRenderer.send('update-check', 'check-update')
window.addEventListener('online', function() {
if (!store.getState().status.updateReady) {
ipcRenderer.send('update-check', 'check-update')
}
})
}
)