git ssb

16+

Dominic / patchbay



Commit 9c48d54a35357e3a8ff864b699903b843a0b13d3

fix tab closing bugs

mix irving committed on 2/8/2018, 6:27:37 AM
Parent: cbef0d72b505f32da320aecf8f0c3251e868f40d

Files changed

app/html/scroller.jschanged
app/html/tabs.jschanged
app/page/thread.jschanged
app/sync/catch-keyboard-shortcut.jschanged
app/html/scroller.jsView
@@ -45,8 +45,9 @@
4545
4646 function selectChild (el) {
4747 if (!el) { return }
4848
49 + if (!el.scrollIntoViewIfNeeded && !el.scrollIntoView) debugger
4950 ;(el.scrollIntoViewIfNeeded || el.scrollIntoView).call(el)
5051 el.focus()
5152 curMsgEl = el
5253 }
app/html/tabs.jsView
@@ -9,8 +9,9 @@
99 exports.needs = nest({
1010 'app.html.menu': 'first',
1111 'app.html.searchBar': 'first',
1212 'app.sync.goTo': 'first',
13 + 'app.sync.locationId': 'first',
1314 'history.obs.store': 'first',
1415 'history.sync.push': 'first'
1516 })
1617
@@ -29,9 +30,8 @@
2930
3031 try {
3132 var location = JSON.parse(id)
3233 } catch (e) {
33- debugger
3434 throw new Error('app.html.tabs expects all page ids to be stringified location objects')
3535 }
3636
3737 api.history.sync.push(location)
@@ -39,9 +39,9 @@
3939 }
4040 const onClose = (page) => {
4141 var history = api.history.obs.store()
4242 const prunedHistory = history().filter(loc => {
43- return JSON.stringify(loc) != page.id
43 + return api.app.sync.locationId(loc) != page.id
4444 })
4545 history.set(prunedHistory)
4646 }
4747
app/page/thread.jsView
@@ -97,8 +97,10 @@
9797 function locateKey () {
9898 // wait till we're on the right page
9999 if (tabs.currentPage().id !== locationId) return setTimeout(locateKey, 200)
100100
101 + if (!tabs.currentPage().scroll) return setTimeout(locateKey, 200)
102 +
101103 tabs.currentPage().scroll('first')
102104 const msg = tabs.currentPage().querySelector(`[data-id='${id}']`)
103105 if (msg === null) return setTimeout(locateKey, 200)
104106
app/sync/catch-keyboard-shortcut.jsView
@@ -4,9 +4,9 @@
44
55 exports.needs = nest({
66 'app.html.searchBar': 'first',
77 'app.html.tabs': 'first',
8- 'app.sync.goTo': 'first'
8 + 'app.sync.goTo': 'first',
99 })
1010
1111 var gPressed = false
1212
@@ -42,9 +42,9 @@
4242 return ev.target.blur()
4343 }
4444 }
4545
46-function genericShortcuts (ev, { tabs, search, goTo }) {
46 +function genericShortcuts (ev, { tabs, search, goTo, back }) {
4747 // Messages
4848 if (ev.keyCode === 71) { // gg = scroll to top
4949 if (!gPressed) {
5050 gPressed = true

Built with git-ssb-web