File tree Expand file tree Collapse file tree 7 files changed +77
-1
lines changed Expand file tree Collapse file tree 7 files changed +77
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ webview {
1717}
1818
1919navbar {
20+ z-index : 2 ;
2021 height : 23px ;
2122 align-items : center;
2223 width : 100% ;
@@ -90,3 +91,37 @@ navbar.unsupported {
9091# navbar-container .control-buttons > .pin-window .pinned {
9192 transform : rotate (0 );
9293}
94+
95+ * : focus {
96+ outline : none;
97+ }
98+
99+ .electronSearchText-box {
100+ font-family : "Courier New" , Courier, monospace;
101+ position : absolute;
102+ top : -11px ;
103+ transition : transform cubic-bezier (0.165 , 0.84 , 0.44 , 1 ) .3s ;
104+ right : 20px ;
105+ box-sizing : border-box;
106+ height : 40px ;
107+ }
108+
109+ .electronSearchText-input {
110+ box-sizing : border-box;
111+ width : 220px ;
112+ padding : 5px ;
113+ font-size : 14px ;
114+ outline-width : 2px ;
115+ }
116+
117+ .electronSearchText-count {
118+ position : absolute;
119+ top : 0 ;
120+ right : 10px ;
121+ line-height : 33px ;
122+ }
123+
124+ .electronSearchText-visible {
125+ transform : translateY (33px );
126+ display : block;
127+ }
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ <h4 class="modal-title">Customize HackMD server</h4>
2828 </ div >
2929 </ div >
3030 </ div >
31+ < div class ="electronSearchText-box ">
32+ < input type ="text " class ="electronSearchText-input ">
33+ < span class ="electronSearchText-count "> </ span >
34+ </ div >
3135 < navbar >
3236 < div id ="navbar-container ">
3337 < div class ="control-buttons ">
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ module.exports = function (commandId, args = {}) {
4343 case 'copyUrl' :
4444 BrowserWindow . getFocusedWindow ( ) . webContents . send ( 'copy-url' )
4545 break
46+ case 'toggleSearch' :
47+ BrowserWindow . getFocusedWindow ( ) . webContents . send ( 'toggle-search' )
48+ break
4649 default :
4750 break
4851 }
Original file line number Diff line number Diff line change @@ -52,6 +52,19 @@ const template = [
5252 exec ( 'copyUrl' )
5353 }
5454 } ,
55+ {
56+ type : 'separator'
57+ } ,
58+ {
59+ label : 'Search' ,
60+ accelerator : 'CmdOrCtrl+F' ,
61+ click ( ) {
62+ exec ( 'toggleSearch' )
63+ }
64+ } ,
65+ {
66+ type : 'separator'
67+ } ,
5568 {
5669 role : 'paste'
5770 } ,
Original file line number Diff line number Diff line change 3636 },
3737 "dependencies" : {
3838 "electron-config" : " ^0.2.1" ,
39+ "electron-search-text" : " ^0.3.0" ,
3940 "jquery" : " ^3.2.1" ,
4041 "node-fetch" : " ^1.6.3" ,
4142 "semver" : " ^5.3.0" ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const path = remote.require('path')
77const Config = require ( 'electron-config' )
88const config = new Config ( )
99const validate = require ( 'validate.js' )
10+ const ElectronSearchText = require ( 'electron-search-text' )
1011
1112const ipcClient = require ( './ipc/client' )
1213
@@ -38,6 +39,10 @@ window.onload = () => {
3839
3940 const webview = document . getElementById ( 'main-window' )
4041
42+ const searcher = new ElectronSearchText ( {
43+ target : '#main-window'
44+ } )
45+
4146 function copyUrl ( ) {
4247 clipboard . writeText ( webview . getURL ( ) )
4348 new Notification ( 'URL copied' , { title : 'URL copied' , body : webview . getURL ( ) } ) // eslint-disable-line no-new
@@ -170,6 +175,10 @@ window.onload = () => {
170175 copyUrl ( )
171176 } )
172177
178+ ipcRenderer . on ( 'toggle-search' , function ( ) {
179+ searcher . emit ( 'toggle' )
180+ } )
181+
173182 $ ( '#serverurl-config-modal.modal #submit-serverurl' ) . click ( function ( ) {
174183 let serverurl = $ ( '#serverurl-config-modal.modal input[type="text"]' ) . val ( )
175184
Original file line number Diff line number Diff line change @@ -611,6 +611,13 @@ electron-macos-sign@~1.5.0:
611611 isbinaryfile "^3.0.2"
612612 plist "^2.0.1"
613613
614+ electron-search-text@^0.3.0 :
615+ version "0.3.0"
616+ resolved "https://registry.yarnpkg.com/electron-search-text/-/electron-search-text-0.3.0.tgz#eff07aa9e95f9b3783a93197362c8be3788a3d3d"
617+ dependencies :
618+ eventemitter2 "^2.0.1"
619+ lodash "^4.14.1"
620+
614621electron@^1.4.15 :
615622 version "1.6.4"
616623 resolved "https://registry.yarnpkg.com/electron/-/electron-1.6.4.tgz#ec8e5b5d8fe7dcc8fe8754beaca1eabc1d7163e9"
@@ -827,6 +834,10 @@ event-emitter@~0.3.5:
827834 d "1"
828835 es5-ext "~0.10.14"
829836
837+ eventemitter2@^2.0.1 :
838+ version "2.2.2"
839+ resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-2.2.2.tgz#407ea71c2020cd57538203ab7e7a6bdcfb7692d5"
840+
830841exit-hook@^1.0.0 :
831842 version "1.1.1"
832843 resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8"
@@ -1426,7 +1437,7 @@ locate-path@^2.0.0:
14261437 p-locate "^2.0.0"
14271438 path-exists "^3.0.0"
14281439
1429- lodash@^4.0.0, lodash@^4.3.0 :
1440+ lodash@^4.0.0, lodash@^4.14.1, lodash@^4. 3.0 :
14301441 version "4.17.4"
14311442 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
14321443
You can’t perform that action at this time.
0 commit comments