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 {
17
17
}
18
18
19
19
navbar {
20
+ z-index : 2 ;
20
21
height : 23px ;
21
22
align-items : center;
22
23
width : 100% ;
@@ -90,3 +91,37 @@ navbar.unsupported {
90
91
# navbar-container .control-buttons > .pin-window .pinned {
91
92
transform : rotate (0 );
92
93
}
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>
28
28
</ div >
29
29
</ div >
30
30
</ div >
31
+ < div class ="electronSearchText-box ">
32
+ < input type ="text " class ="electronSearchText-input ">
33
+ < span class ="electronSearchText-count "> </ span >
34
+ </ div >
31
35
< navbar >
32
36
< div id ="navbar-container ">
33
37
< div class ="control-buttons ">
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ module.exports = function (commandId, args = {}) {
43
43
case 'copyUrl' :
44
44
BrowserWindow . getFocusedWindow ( ) . webContents . send ( 'copy-url' )
45
45
break
46
+ case 'toggleSearch' :
47
+ BrowserWindow . getFocusedWindow ( ) . webContents . send ( 'toggle-search' )
48
+ break
46
49
default :
47
50
break
48
51
}
Original file line number Diff line number Diff line change @@ -52,6 +52,19 @@ const template = [
52
52
exec ( 'copyUrl' )
53
53
}
54
54
} ,
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
+ } ,
55
68
{
56
69
role : 'paste'
57
70
} ,
Original file line number Diff line number Diff line change 36
36
},
37
37
"dependencies" : {
38
38
"electron-config" : " ^0.2.1" ,
39
+ "electron-search-text" : " ^0.3.0" ,
39
40
"jquery" : " ^3.2.1" ,
40
41
"node-fetch" : " ^1.6.3" ,
41
42
"semver" : " ^5.3.0" ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const path = remote.require('path')
7
7
const Config = require ( 'electron-config' )
8
8
const config = new Config ( )
9
9
const validate = require ( 'validate.js' )
10
+ const ElectronSearchText = require ( 'electron-search-text' )
10
11
11
12
const ipcClient = require ( './ipc/client' )
12
13
@@ -38,6 +39,10 @@ window.onload = () => {
38
39
39
40
const webview = document . getElementById ( 'main-window' )
40
41
42
+ const searcher = new ElectronSearchText ( {
43
+ target : '#main-window'
44
+ } )
45
+
41
46
function copyUrl ( ) {
42
47
clipboard . writeText ( webview . getURL ( ) )
43
48
new Notification ( 'URL copied' , { title : 'URL copied' , body : webview . getURL ( ) } ) // eslint-disable-line no-new
@@ -170,6 +175,10 @@ window.onload = () => {
170
175
copyUrl ( )
171
176
} )
172
177
178
+ ipcRenderer . on ( 'toggle-search' , function ( ) {
179
+ searcher . emit ( 'toggle' )
180
+ } )
181
+
173
182
$ ( '#serverurl-config-modal.modal #submit-serverurl' ) . click ( function ( ) {
174
183
let serverurl = $ ( '#serverurl-config-modal.modal input[type="text"]' ) . val ( )
175
184
Original file line number Diff line number Diff line change @@ -611,6 +611,13 @@ electron-macos-sign@~1.5.0:
611
611
isbinaryfile "^3.0.2"
612
612
plist "^2.0.1"
613
613
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
+
614
621
electron@^1.4.15 :
615
622
version "1.6.4"
616
623
resolved "https://registry.yarnpkg.com/electron/-/electron-1.6.4.tgz#ec8e5b5d8fe7dcc8fe8754beaca1eabc1d7163e9"
@@ -827,6 +834,10 @@ event-emitter@~0.3.5:
827
834
d "1"
828
835
es5-ext "~0.10.14"
829
836
837
+ eventemitter2@^2.0.1 :
838
+ version "2.2.2"
839
+ resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-2.2.2.tgz#407ea71c2020cd57538203ab7e7a6bdcfb7692d5"
840
+
830
841
exit-hook@^1.0.0 :
831
842
version "1.1.1"
832
843
resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8"
@@ -1426,7 +1437,7 @@ locate-path@^2.0.0:
1426
1437
p-locate "^2.0.0"
1427
1438
path-exists "^3.0.0"
1428
1439
1429
- lodash@^4.0.0, lodash@^4.3.0 :
1440
+ lodash@^4.0.0, lodash@^4.14.1, lodash@^4. 3.0 :
1430
1441
version "4.17.4"
1431
1442
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
1432
1443
You can’t perform that action at this time.
0 commit comments