File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,11 +9,16 @@ import ArticleDetail from './ArticleDetail'
99import _ from 'lodash'
1010import { isModalOpen , closeModal } from 'browser/lib/modal'
1111
12+ const electron = require ( 'electron' )
13+ const remote = electron . remote
14+
1215const TEXT_FILTER = 'TEXT_FILTER'
1316const FOLDER_FILTER = 'FOLDER_FILTER'
1417const FOLDER_EXACT_FILTER = 'FOLDER_EXACT_FILTER'
1518const TAG_FILTER = 'TAG_FILTER'
1619
20+ const OSX = global . process . platform === 'darwin'
21+
1722class HomePage extends React . Component {
1823 componentDidMount ( ) {
1924 // React自体のKey入力はfocusされていないElementからは動かないため、
@@ -28,6 +33,9 @@ class HomePage extends React.Component {
2833
2934 handleKeyDown ( e ) {
3035 if ( isModalOpen ( ) ) {
36+ if ( e . keyCode === 13 && ( OSX ? e . metaKey : e . ctrlKey ) ) {
37+ remote . getCurrentWebContents ( ) . send ( 'modal-confirm' )
38+ }
3139 if ( e . keyCode === 27 ) closeModal ( )
3240 return
3341 }
Original file line number Diff line number Diff line change @@ -3,9 +3,23 @@ import ReactDOM from 'react-dom'
33import store from '../store'
44import { destroyArticle } from '../actions'
55
6+ const electron = require ( 'electron' )
7+ const ipc = electron . ipcRenderer
8+
69export default class DeleteArticleModal extends React . Component {
10+ constructor ( props ) {
11+ super ( props )
12+
13+ this . confirmHandler = e => this . handleYesButtonClick ( )
14+ }
15+
716 componentDidMount ( ) {
817 ReactDOM . findDOMNode ( this . refs . no ) . focus ( )
18+ ipc . on ( 'modal-confirm' , this . confirmHandler )
19+ }
20+
21+ componentWillUnmount ( ) {
22+ ipc . removeListener ( 'modal-confirm' , this . confirmHandler )
923 }
1024
1125 handleNoButtonClick ( e ) {
You can’t perform that action at this time.
0 commit comments