Commit 563a47e65cc3a33e94dbc286e9b78d81a1b2d623
add blob view to router
mix irving committed on 3/19/2017, 8:31:56 PMParent: c24aab4d406daa99a57712bf37fc9f5d7c2971ff
Files changed
router/html/page/blob.js | added |
router/html/page/blob.mcss | added |
router/html/page/blob.js | ||
---|---|---|
@@ -1,0 +1,25 @@ | ||
1 | +const nest = require('depnest') | |
2 | +const ref = require('ssb-ref') | |
3 | +const Scroller = require('pull-scroll') | |
4 | +const pull = require('pull-stream') | |
5 | +const { h, watch } = require('mutant') | |
6 | + | |
7 | +exports.gives = nest('router.html.page') | |
8 | + | |
9 | +exports.needs = nest('blob.sync.url', 'first') | |
10 | + | |
11 | +exports.create = (api) => { | |
12 | + return nest('router.html.page', blobView) | |
13 | + | |
14 | + function blobView (path) { | |
15 | + if (!ref.isBlob(path)) return | |
16 | + | |
17 | + return h('Blob', { id: path, title: path.slice(0, 9) + '...' }, [ | |
18 | + h('iframe', { | |
19 | + src: api.blob.sync.url(path), | |
20 | + sandbox: '' | |
21 | + }) | |
22 | + ]) | |
23 | + } | |
24 | +} | |
25 | + |
Built with git-ssb-web