Browse Source

搜索增加快捷键。

oldj 9 years ago
parent
commit
99e16276a9
5 changed files with 8902 additions and 8774 deletions
  1. 8833 8694
      app/build/bundle.js
  2. 7 0
      app/src/components/panel/buttons.js
  3. 2 0
      app/src/lang.js
  4. 59 79
      app/src/modules/mainMenu.js
  5. 1 1
      app/src/version.js

File diff suppressed because it is too large
+ 8833 - 8694
app/build/bundle.js


+ 7 - 0
app/src/components/panel/buttons.js

@@ -37,6 +37,7 @@ export default class Buttons extends React.Component {
         ipcRenderer.on('to_add_host', () => {
             SH_event.emit('add_host');
         });
+
     }
 
     static btnAdd() {
@@ -76,6 +77,12 @@ export default class Buttons extends React.Component {
         });
     }
 
+    componentDidMount() {
+        ipcRenderer.on('to_search', () => {
+            this.btnSearch();
+        });
+    }
+
     render() {
         return (
             <div id="sh-buttons">

+ 2 - 0
app/src/lang.js

@@ -68,6 +68,7 @@ var languages = {
         , pref_choice_mode: 'Choide mode'
         , pref_choice_single: 'Single choice'
         , pref_choice_multiple: 'Multiple choice'
+        , search: 'Search'
     },
     'cn': {
         _lang_name: '简体中文'
@@ -131,6 +132,7 @@ var languages = {
         , pref_choice_mode: '选择模式'
         , pref_choice_mode_single: '单选'
         , pref_choice_mode_multiple: '多选'
+        , search: '搜索'
     }
 };
 

+ 59 - 79
app/src/modules/mainMenu.js

@@ -74,37 +74,35 @@ exports.init = function (app, sys_lang = 'en') {
         },
         {
             label: lang.edit,
-            submenu: [
-                {
-                    role: 'undo'
-                },
-                {
-                    role: 'redo'
-                },
-                {
-                    type: 'separator'
-                },
-                {
-                    role: 'cut'
-                },
-                {
-                    role: 'copy'
-                },
-                {
-                    role: 'paste'
-                },
-                {
-                    role: 'pasteandmatchstyle'
-                },
-                {
-                    role: 'delete'
-                },
-                {
-                    role: 'selectall'
+            submenu: [{
+                role: 'undo'
+            }, {
+                role: 'redo'
+            }, {
+                type: 'separator'
+            }, {
+                role: 'cut'
+            }, {
+                role: 'copy'
+            }, {
+                role: 'paste'
+            }, {
+                role: 'pasteandmatchstyle'
+            }, {
+                role: 'delete'
+            }, {
+                role: 'selectall'
+            }, {
+                type: 'separator'
+            }, {
+                label: lang.search,
+                accelerator: 'CommandOrControl+F',
+                click () {
+                    // ipcMain.emit('to_search');
+                    app.mainWindow.webContents.send('to_search');
                 }
-            ]
-        },
-        {
+            }]
+        }, {
             label: lang.view,
             submenu: [
                 // {
@@ -126,49 +124,38 @@ exports.init = function (app, sys_lang = 'en') {
                 // },
                 {
                     role: 'resetzoom'
-                },
-                {
+                }, {
                     role: 'zoomin'
-                },
-                {
+                }, {
                     role: 'zoomout'
-                },
-                {
+                }, {
                     type: 'separator'
-                },
-                {
+                }, {
                     role: 'togglefullscreen'
                 }
             ]
-        },
-        {
+        }, {
             label: lang.window,
             role: 'window',
-            submenu: [
-                {
-                    role: 'minimize'
-                },
-                {
-                    role: 'close'
-                }
-            ]
-        },
-        {
+            submenu: [{
+                role: 'minimize'
+            }, {
+                role: 'close'
+            }]
+        }, {
             label: lang.help,
             role: 'help',
-            submenu: [
-                {
-                    label: lang.feedback,
-                    click () {
-                        shell.openExternal('https://github.com/oldj/SwitchHosts/issues');
-                    }
-                }, {
-                    label: lang.homepage,
-                    click () {
-                        shell.openExternal('http://oldj.github.io/SwitchHosts/');
-                    }
+            submenu: [{
+                label: lang.feedback,
+                click () {
+                    shell.openExternal('https://github.com/oldj/SwitchHosts/issues');
                 }
-            ]
+            }, {
+                label: lang.homepage,
+                click () {
+                    shell.openExternal('http://oldj.github.io/SwitchHosts/');
+                }
+            }]
         }
     ];
 
@@ -177,13 +164,11 @@ exports.init = function (app, sys_lang = 'en') {
     if (os === 'darwin') {
         template.unshift({
             label: name,
-            submenu: [
-                {
-                    role: 'about'
-                },
-                {
-                    type: 'separator'
-                },
+            submenu: [{
+                role: 'about'
+            }, {
+                type: 'separator'
+            },
                 // {
                 //     role: 'services',
                 //     submenu: []
@@ -193,20 +178,15 @@ exports.init = function (app, sys_lang = 'en') {
                 // },
                 {
                     role: 'hide'
-                },
-                {
+                }, {
                     role: 'hideothers'
-                },
-                {
+                }, {
                     role: 'unhide'
-                },
-                {
+                }, {
                     type: 'separator'
-                },
-                {
+                }, {
                     role: 'quit'
-                }
-            ]
+                }]
         });
         // Edit menu.
         /*template[2].submenu.push(

+ 1 - 1
app/src/version.js

@@ -1 +1 @@
-exports.version = [3,2,0,4167];
+exports.version = [3,2,0,4169];

Some files were not shown because too many files changed in this diff