Commit 53596157e8d794eec9cdef21945b4dc01060a4a6
patch-inbox : unread vis!
mixmix committed on 11/2/2018, 3:41:03 AMParent: 91eff7281ce5dbfb9a1569327348c887074ac005
Files changed
app/html/scroller.js | changed |
package-lock.json | changed |
package.json | changed |
app/html/scroller.js | |||
---|---|---|---|
@@ -6,9 +6,9 @@ | |||
6 | 6 … | exports.create = function (api) { | |
7 | 7 … | return nest('app.html.scroller', Scroller) | |
8 | 8 … | ||
9 | 9 … | function Scroller (opts = {}) { | |
10 | - const { prepend, content = null, append, classList = [], className = '', title = '' } = opts | ||
10 … | + const { prepend, content = null, append, classList = [], className = '', title = '', scrollIntoView } = opts | ||
11 | 11 … | ||
12 | 12 … | const contentSection = h('section.content', { title: '' }, content) | |
13 | 13 … | ||
14 | 14 … | const container = h('Scroller', | |
@@ -19,18 +19,18 @@ | |||
19 | 19 … | append ? h('section.bottom', append) : null | |
20 | 20 … | ] | |
21 | 21 … | ) | |
22 | 22 … | ||
23 | - container.scroll = keyscroll(contentSection) | ||
23 … | + container.scroll = keyscroll(contentSection, scrollIntoView) | ||
24 | 24 … | ||
25 | 25 … | return { | |
26 | 26 … | content: contentSection, | |
27 | 27 … | container | |
28 | 28 … | } | |
29 | 29 … | } | |
30 | 30 … | } | |
31 | 31 … | ||
32 | -function keyscroll (content) { | ||
32 … | +function keyscroll (content, scrollIntoView = false) { | ||
33 | 33 … | var curMsgEl | |
34 | 34 … | ||
35 | 35 … | if (!content) return () => {} | |
36 | 36 … | ||
@@ -59,11 +59,15 @@ | |||
59 | 59 … | ||
60 | 60 … | function selectChild (el) { | |
61 | 61 … | if (!el) { return } | |
62 | 62 … | ||
63 | - content.parentElement.scrollTop = el.offsetTop - content.parentElement.offsetTop - 10 | ||
64 | - // if (!el.scrollIntoViewIfNeeded && !el.scrollIntoView) return | ||
65 | - // ;(el.scrollIntoViewIfNeeded || el.scrollIntoView).call(el) | ||
63 … | + if (scrollIntoView) { | ||
64 … | + if (!el.scrollIntoViewIfNeeded && !el.scrollIntoView) return | ||
65 … | + ;(el.scrollIntoViewIfNeeded || el.scrollIntoView).call(el) | ||
66 … | + } else { | ||
67 … | + content.parentElement.scrollTop = el.offsetTop - content.parentElement.offsetTop - 10 | ||
68 … | + } | ||
69 … | + | ||
66 | 70 … | if (el.focus) el.focus() | |
67 | 71 … | curMsgEl = el | |
68 | 72 … | } | |
69 | 73 … | } |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 377106 bytes New file size: 377106 bytes |
package.json | ||
---|---|---|
@@ -65,9 +65,9 @@ | ||
65 | 65 … | "open-external": "^0.1.1", |
66 | 66 … | "patch-context": "^2.0.1", |
67 | 67 … | "patch-drafts": "0.0.6", |
68 | 68 … | "patch-history": "^1.0.0", |
69 | - "patch-inbox": "^1.2.0", | |
69 … | + "patch-inbox": "^1.3.0", | |
70 | 70 … | "patch-settings": "^1.1.2", |
71 | 71 … | "patch-suggest": "^2.0.2", |
72 | 72 … | "patchbay-book": "^1.0.8", |
73 | 73 … | "patchbay-dark-crystal": "^1.1.1", |
Built with git-ssb-web