git ssb

16+

Dominic / patchbay



Commit 29160dfc50920ef4a843f78792e42bf1f2a71353

re link the page ids to the "command" bar

mix irving committed on 2/2/2017, 11:00:41 PM
Parent: 6ae6f1ce78d440dea5e42c9ab6d0112732b161f6

Files changed

modules_core/search-box.jschanged
modules_core/tabs.jschanged
modules_extra/search.jschanged
modules_core/search-box.jsView
@@ -26,9 +26,8 @@
2626 placeholder: 'Commands',
2727 'ev-keyup': ev => {
2828 switch (ev.keyCode) {
2929 case 13: // enter
30- console.log(ev)
3130 ev.stopPropagation()
3231 suggestBox.complete()
3332
3433 if (go(input.value.trim(), !ev.ctrlKey))
@@ -42,8 +41,9 @@
4241 }
4342 })
4443 const search = h('Search', input)
4544
45 + search.input = input
4646 search.activate = (sigil, ev) => {
4747 input.focus()
4848 ev.preventDefault()
4949 if (input.value[0] === sigil) {
modules_core/tabs.jsView
@@ -23,39 +23,34 @@
2323 return function (path) {
2424 if(path !== 'tabs') return
2525
2626 function setSelected (indexes) {
27- var ids = indexes.map(function (index) {
28- return tabs.get(index).id
29- })
27 + const ids = indexes.map(index => tabs.get(index).content.id)
3028 if(search)
3129 if(ids.length > 1)
32- search.value = 'split('+ids.join(',')+')'
30 + search.input.value = 'split('+ids.join(',')+')'
3331 else
34- search.value = ids[0]
32 + search.input.value = ids[0]
3533 }
3634
37- var search
38- var tabs = Tabs(setSelected)
39-
40- search = api.search_box(function (path, change) {
41-
35 + const tabs = Tabs(setSelected)
36 + const search = api.search_box((path, change) => {
4237 if(tabs.has(path)) {
4338 tabs.select(path)
4439 return true
4540 }
46- var el = api.screen_view(path)
4741
48- if(el) {
49- if(!el.title) el.title = path
50- el.scroll = keyscroll(el.querySelector('.Scroller .\\.content'))
51- tabs.add(el, change)
52- // localStorage.openTabs = JSON.stringify(tabs.tabs)
53- return change
54- }
42 + const el = api.screen_view(path)
43 + if (!el) return
44 +
45 + if(!el.title) el.title = path
46 + el.scroll = keyscroll(el.querySelector('.Scroller .\\.content'))
47 + tabs.add(el, change)
48 +// localStorage.openTabs = JSON.stringify(tabs.tabs)
49 + return change
5550 })
5651
57- // TODO add a Tabs(setSelected, { append: el }) to hypertabs
52 + // TODO add options to Tabs : e.g. Tabs(setSelected, { append: el })
5853 tabs.firstChild.appendChild(
5954 h('div.extra', [
6055 search,
6156 api.menu()
@@ -78,8 +73,9 @@
7873 if(el) tabs.add(el, false, false)
7974 })
8075
8176 tabs.select(0)
77 + search.input.value = null // start with an empty field to show placeholder
8278
8379 //handle link clicks
8480 window.onclick = function (ev) {
8581 var link = ancestor(ev.target)
modules_extra/search.jsView
@@ -61,8 +61,9 @@
6161 var total = 0, matches = 0
6262
6363 var header = h('div.search_header', '')
6464 var { container, content } = api.build_scroller({ prepend: header})
65 + container.id = path // helps tabs find this tab
6566
6667 function matchesQuery (data) {
6768 total++
6869 var m = _matches(data)

Built with git-ssb-web