mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
FinderのActivity logをちゃんと取ってくる
This commit is contained in:
@@ -11,7 +11,7 @@ import _ from 'lodash'
|
||||
import dataStore from 'boost/dataStore'
|
||||
|
||||
const electron = require('electron')
|
||||
const { remote, clipboard } = electron
|
||||
const { remote, clipboard, ipcRenderer } = electron
|
||||
|
||||
var hideFinder = remote.getGlobal('hideFinder')
|
||||
|
||||
@@ -64,6 +64,7 @@ class FinderMain extends React.Component {
|
||||
let { activeArticle } = this.props
|
||||
clipboard.writeText(activeArticle.content)
|
||||
|
||||
ipcRenderer.send('copy-finder')
|
||||
notify('Saved to Clipboard!', {
|
||||
body: 'Paste it wherever you want!'
|
||||
})
|
||||
|
||||
@@ -29,6 +29,13 @@ ipc.on('notify', function (e, payload) {
|
||||
})
|
||||
})
|
||||
|
||||
ipc.on('copy-finder', function () {
|
||||
activityRecord.emit('FINDER_COPY')
|
||||
})
|
||||
ipc.on('open-finder', function () {
|
||||
activityRecord.emit('FINDER_OPEN')
|
||||
})
|
||||
|
||||
let routes = (
|
||||
<Route path='/' component={MainPage}>
|
||||
<IndexRoute name='home' component={HomePage}/>
|
||||
|
||||
@@ -3,6 +3,7 @@ const app = electron.app
|
||||
const Tray = electron.Tray
|
||||
const Menu = electron.Menu
|
||||
const MenuItem = electron.MenuItem
|
||||
const ipcMain = electron.ipcMain
|
||||
|
||||
process.stdin.setEncoding('utf8')
|
||||
|
||||
@@ -63,6 +64,10 @@ app.on('ready', function () {
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.on('copy-finder', function () {
|
||||
emit('copy-finder')
|
||||
})
|
||||
})
|
||||
|
||||
global.hideFinder = function () {
|
||||
|
||||
7
main.js
7
main.js
@@ -129,9 +129,10 @@ app.on('ready', function () {
|
||||
console.log('FINDER(stdout): ' + payload.data)
|
||||
break
|
||||
case 'show-main-window':
|
||||
if (mainWindow != null) {
|
||||
mainWindow.show()
|
||||
}
|
||||
break
|
||||
case 'copy-finder':
|
||||
mainWindow.webContents.send('copy-finder')
|
||||
break
|
||||
case 'request-data':
|
||||
mainWindow.webContents.send('request-data')
|
||||
@@ -174,6 +175,7 @@ app.on('ready', function () {
|
||||
try {
|
||||
globalShortcut.register(toggleFinderKey, function () {
|
||||
emitToFinder('open-finder')
|
||||
mainWindow.webContents.send('open-finder', {})
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err.name)
|
||||
@@ -190,6 +192,7 @@ app.on('ready', function () {
|
||||
try {
|
||||
globalShortcut.register(toggleFinderKey, function () {
|
||||
emitToFinder('open-finder')
|
||||
mainWindow.webContents.send('open-finder', {})
|
||||
})
|
||||
mainWindow.webContents.send('APP_SETTING_DONE', {})
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user