Commit 9c48d54a35357e3a8ff864b699903b843a0b13d3
fix tab closing bugs
mix irving committed on 2/8/2018, 6:27:37 AMParent: cbef0d72b505f32da320aecf8f0c3251e868f40d
Files changed
app/html/scroller.js | changed |
app/html/tabs.js | changed |
app/page/thread.js | changed |
app/sync/catch-keyboard-shortcut.js | changed |
app/html/scroller.js | ||
---|---|---|
@@ -45,8 +45,9 @@ | ||
45 | 45 … | |
46 | 46 … | function selectChild (el) { |
47 | 47 … | if (!el) { return } |
48 | 48 … | |
49 … | + if (!el.scrollIntoViewIfNeeded && !el.scrollIntoView) debugger | |
49 | 50 … | ;(el.scrollIntoViewIfNeeded || el.scrollIntoView).call(el) |
50 | 51 … | el.focus() |
51 | 52 … | curMsgEl = el |
52 | 53 … | } |
app/html/tabs.js | ||
---|---|---|
@@ -9,8 +9,9 @@ | ||
9 | 9 … | exports.needs = nest({ |
10 | 10 … | 'app.html.menu': 'first', |
11 | 11 … | 'app.html.searchBar': 'first', |
12 | 12 … | 'app.sync.goTo': 'first', |
13 … | + 'app.sync.locationId': 'first', | |
13 | 14 … | 'history.obs.store': 'first', |
14 | 15 … | 'history.sync.push': 'first' |
15 | 16 … | }) |
16 | 17 … | |
@@ -29,9 +30,8 @@ | ||
29 | 30 … | |
30 | 31 … | try { |
31 | 32 … | var location = JSON.parse(id) |
32 | 33 … | } catch (e) { |
33 | - debugger | |
34 | 34 … | throw new Error('app.html.tabs expects all page ids to be stringified location objects') |
35 | 35 … | } |
36 | 36 … | |
37 | 37 … | api.history.sync.push(location) |
@@ -39,9 +39,9 @@ | ||
39 | 39 … | } |
40 | 40 … | const onClose = (page) => { |
41 | 41 … | var history = api.history.obs.store() |
42 | 42 … | const prunedHistory = history().filter(loc => { |
43 | - return JSON.stringify(loc) != page.id | |
43 … | + return api.app.sync.locationId(loc) != page.id | |
44 | 44 … | }) |
45 | 45 … | history.set(prunedHistory) |
46 | 46 … | } |
47 | 47 … |
app/page/thread.js | ||
---|---|---|
@@ -97,8 +97,10 @@ | ||
97 | 97 … | function locateKey () { |
98 | 98 … | // wait till we're on the right page |
99 | 99 … | if (tabs.currentPage().id !== locationId) return setTimeout(locateKey, 200) |
100 | 100 … | |
101 … | + if (!tabs.currentPage().scroll) return setTimeout(locateKey, 200) | |
102 … | + | |
101 | 103 … | tabs.currentPage().scroll('first') |
102 | 104 … | const msg = tabs.currentPage().querySelector(`[data-id='${id}']`) |
103 | 105 … | if (msg === null) return setTimeout(locateKey, 200) |
104 | 106 … |
app/sync/catch-keyboard-shortcut.js | ||
---|---|---|
@@ -4,9 +4,9 @@ | ||
4 | 4 … | |
5 | 5 … | exports.needs = nest({ |
6 | 6 … | 'app.html.searchBar': 'first', |
7 | 7 … | 'app.html.tabs': 'first', |
8 | - 'app.sync.goTo': 'first' | |
8 … | + 'app.sync.goTo': 'first', | |
9 | 9 … | }) |
10 | 10 … | |
11 | 11 … | var gPressed = false |
12 | 12 … | |
@@ -42,9 +42,9 @@ | ||
42 | 42 … | return ev.target.blur() |
43 | 43 … | } |
44 | 44 … | } |
45 | 45 … | |
46 | -function genericShortcuts (ev, { tabs, search, goTo }) { | |
46 … | +function genericShortcuts (ev, { tabs, search, goTo, back }) { | |
47 | 47 … | // Messages |
48 | 48 … | if (ev.keyCode === 71) { // gg = scroll to top |
49 | 49 … | if (!gPressed) { |
50 | 50 … | gPressed = true |
Built with git-ssb-web