git ssb

16+

Dominic / patchbay



Commit 6ae6f1ce78d440dea5e42c9ab6d0112732b161f6

fix searchbox activate

mix irving committed on 2/2/2017, 9:38:28 PM
Parent: 2f3fa2face6b2be68c4502ddf460be8c0783d0bc

Files changed

modules_core/search-box.jschanged
modules_core/search-box.jsView
@@ -20,31 +20,30 @@
2020 mcss: () => fs.readFileSync(__filename.replace(/js$/, 'mcss'), 'utf8')
2121 }
2222
2323 function search_box (go) {
24- var search = h('Search', [
25- h('input', {
26- type: 'search',
27- placeholder: 'Commands',
28- 'ev-click': ev => {
29- switch (ev.keyCode) {
30- case 13: // enter
31- ev.stopPropagation()
32- suggestBox.complete()
24 + const input = h('input', {
25 + type: 'search',
26 + placeholder: 'Commands',
27 + 'ev-keyup': ev => {
28 + switch (ev.keyCode) {
29 + case 13: // enter
30 + console.log(ev)
31 + ev.stopPropagation()
32 + suggestBox.complete()
3333
34- if (go(search.value.trim(), !ev.ctrlKey))
35- search.blur()
36- return
37- case 27: // escape
38- ev.preventDefault()
39- search.blur()
40- return
41- }
34 + if (go(input.value.trim(), !ev.ctrlKey))
35 + input.blur()
36 + return
37 + case 27: // escape
38 + ev.preventDefault()
39 + input.blur()
40 + return
4241 }
43- })
44- ])
42 + }
43 + })
44 + const search = h('Search', input)
4545
46- const input = search.firstChild
4746 search.activate = (sigil, ev) => {
4847 input.focus()
4948 ev.preventDefault()
5049 if (input.value[0] === sigil) {
@@ -54,9 +53,9 @@
5453 input.value = sigil
5554 }
5655 }
5756
58- var suggestBox = api.build_suggest_box(input, api.suggest_search)
57 + const suggestBox = api.build_suggest_box(input, api.suggest_search)
5958
6059 return search
6160 }
6261

Built with git-ssb-web