git ssb

2+

mixmix / ticktack



Commit ee61f163c310b3f658adf766c7d7e0aed9c5e0b3

fix some bugs

mix irving committed on 12/8/2017, 3:23:56 AM
Parent: 5f59445f9e468790a0106acff65bdd3ce873c37a

Files changed

app/page/blogNew.jschanged
blog/html/blog.jschanged
blog/html/post.jschanged
app/page/blogNew.jsView
@@ -1,8 +1,9 @@
11 const nest = require('depnest')
22 const { h, Struct, Value } = require('mutant')
33 const addSuggest = require('suggest-box')
44 const pull = require('pull-stream')
5+const marksum = require('markdown-summary')
56
67 exports.gives = nest('app.page.blogNew')
78
89 exports.needs = nest({
@@ -36,8 +37,9 @@
3637 shrink: false,
3738 prepublish: function (content, cb) {
3839 var m = /\!\[[^]+\]\(([^\)]+)\)/.exec(marksum.image(content.text))
3940 content.thumbnail = m && m[1]
41+ // content.summary = marksum.summary(content.text) // Need a summary whihch doesn't trim the start
4042
4143 var stream = pull.values([content.text])
4244 delete content.text
4345 api.sbot.async.addBlob(stream, function (err, hash) {
@@ -99,9 +101,11 @@
99101
100102 cb(null, suggestions)
101103 }, {cls: 'PatchSuggest.-channelHorizontal'}) // WARNING hacking suggest-box cls
102104
103- channelInput.addEventListener('suggestselect', (e) => meta.channel.set(e.value))
105+ channelInput.addEventListener('suggestselect', (e) => {
106+ meta.channel.set(e.detail.value)
107+ })
104108
105109 return page
106110 }
107111 }
blog/html/blog.jsView
@@ -18,37 +18,33 @@
1818 exports.create = function (api) {
1919
2020 return nest({
2121 'blog.html.title': function (data) {
22- if('blog' == typeof data.value.content.type) return
22+ if('blog' !== data.value.content.type) return
2323 return data.value.content.title
2424 },
2525 'blog.html.summary': function (data) {
26- if('blog' == typeof data.value.content.type) return
26+ if('blog' !== data.value.content.type) return
2727 return data.value.content.summary
2828 },
2929 'blog.html.thumbnail': function (data) {
30- if('blog' == typeof data.value.content.type) return
30+ if('blog' !== data.value.content.type) return
3131 return data.value.content.thumbnail
3232 },
3333 'blog.html.content': function (data) {
34- if('blog' == typeof data.value.content.type) return
34+ if('blog' !== data.value.content.type) return
3535 var div = h('Markdown')
3636 pull(
3737 api.sbot.pull.stream(function (sbot) {
3838 return sbot.blobs.get(data.value.content.blog)
3939 }),
4040 pull.collect(function (err, ary) {
4141 if(err) return
42- var md = api.message.html.markdown({text:Buffer.concat(ary).toString()})
42+ var md = api.message.html.markdown({text: Buffer.concat(ary).toString()})
4343 div.innerHTML = md.innerHTML
4444 })
4545 )
4646 return div
4747 }
4848 })
4949 }
5050
51-
52-
53-
54-
blog/html/post.jsView
@@ -31,8 +31,9 @@
3131 'blog.html.thumbnail': function (data) {
3232 if('post' !== data.value.content.type) return
3333 var content = data.value.content
3434 if(content.thumbnail) return content.thumbnail
35+
3536 var img = marksum.image(content.text)
3637 var m = /\!\[[^]+\]\(([^\)]+)\)/.exec(img)
3738 if(m) return m[1]
3839 },

Built with git-ssb-web