Commit a168beb1551b3abbd4db5b2ccc4bd53583876661
Merge branch 'fixes' of ssb://%s9mSFATE4RGyJx9wgH22lBrvD4CgUQW4yeguSWWjtqc=.sha256
Dominic Tarr committed on 12/14/2016, 8:49:10 PMParent: c197e9f63517b0f5a43f48d84688058cc0bc5efe
Parent: a6a59db36ece748b70579031447cb554d68038a1
Files changed
modules_basic/markdown.js | changed |
modules_basic/private.js | changed |
modules_core/file-input.js | changed |
modules_extra/channel.js | changed |
modules_basic/markdown.js | ||
---|---|---|
@@ -1,32 +1,26 @@ | ||
1 | 1 … | var markdown = require('ssb-markdown') |
2 | 2 … | var h = require('hyperscript') |
3 | 3 … | var ref = require('ssb-ref') |
4 | 4 … | |
5 | -//var plugs = require('../plugs') | |
6 | -//var blob_url = plugs.first(exports.blob_url = []) | |
7 | -//var emoji_url = plugs.first(exports.emoji_url = []) | |
8 | - | |
9 | 5 … | exports.needs = { |
10 | 6 … | blob_url: 'first', |
11 | -// emoji_url: 'first' | |
7 … | + emoji_url: 'first' | |
12 | 8 … | } |
13 | 9 … | |
14 | 10 … | exports.gives = 'markdown' |
15 | 11 … | |
16 | 12 … | exports.create = function (api) { |
17 | 13 … | |
18 | -//emoji is in extra, disable for a sec | |
14 … | + function renderEmoji(emoji) { | |
15 … | + var url = api.emoji_url(emoji) | |
16 … | + if (!url) return ':' + emoji + ':' | |
17 … | + return '<img src="' + encodeURI(url) + '"' | |
18 … | + + ' alt=":' + escape(emoji) + ':"' | |
19 … | + + ' title=":' + escape(emoji) + ':"' | |
20 … | + + ' class="emoji">' | |
21 … | + } | |
19 | 22 … | |
20 | -// function renderEmoji(emoji) { | |
21 | -// var url = api.emoji_url(emoji) | |
22 | -// if (!url) return ':' + emoji + ':' | |
23 | -// return '<img src="' + encodeURI(url) + '"' | |
24 | -// + ' alt=":' + escape(emoji) + ':"' | |
25 | -// + ' title=":' + escape(emoji) + ':"' | |
26 | -// + ' class="emoji">' | |
27 | -// } | |
28 | - | |
29 | 23 … | return function (content) { |
30 | 24 … | if('string' === typeof content) |
31 | 25 … | content = {text: content} |
32 | 26 … | //handle patchwork style mentions. |
@@ -37,9 +31,9 @@ | ||
37 | 31 … | }) |
38 | 32 … | |
39 | 33 … | var md = h('div.markdown') |
40 | 34 … | md.innerHTML = markdown.block(content.text, { |
41 | - // emoji: renderEmoji, | |
35 … | + emoji: renderEmoji, | |
42 | 36 … | toUrl: function (id) { |
43 | 37 … | if(ref.isBlob(id)) return api.blob_url(id) |
44 | 38 … | return '#'+(mentions[id]?mentions[id]:id) |
45 | 39 … | } |
modules_basic/private.js | ||
---|---|---|
@@ -4,18 +4,8 @@ | ||
4 | 4 … | var pull = require('pull-stream') |
5 | 5 … | var Scroller = require('pull-scroll') |
6 | 6 … | var ref = require('ssb-ref') |
7 | 7 … | |
8 | -//var plugs = require('../plugs') | |
9 | -// | |
10 | -//var message_render = plugs.first(exports.message_render = []) | |
11 | -//var message_compose = plugs.first(exports.message_compose = []) | |
12 | -//var message_unbox = plugs.first(exports.message_unbox = []) | |
13 | -//var sbot_log = plugs.first(exports.sbot_log = []) | |
14 | -//var sbot_whoami = plugs.first(exports.sbot_whoami = []) | |
15 | -//var avatar_image_link = plugs.first(exports.avatar_image_link = []) | |
16 | -//var emoji_url = plugs.first(exports.emoji_url = []) | |
17 | - | |
18 | 8 … | function map(ary, iter) { |
19 | 9 … | if(Array.isArray(ary)) return ary.map(iter) |
20 | 10 … | } |
21 | 11 … | |
@@ -25,9 +15,9 @@ | ||
25 | 15 … | message_unbox: 'first', |
26 | 16 … | sbot_log: 'first', |
27 | 17 … | sbot_whoami: 'first', |
28 | 18 … | avatar_image_link: 'first', |
29 | -// emoji_link: 'first' | |
19 … | + emoji_url: 'first' | |
30 | 20 … | } |
31 | 21 … | |
32 | 22 … | exports.gives = { |
33 | 23 … | builtin_tabs: true, |
@@ -115,9 +105,9 @@ | ||
115 | 105 … | }, |
116 | 106 … | |
117 | 107 … | message_content_mini: function (msg, sbot) { |
118 | 108 … | if (typeof msg.value.content === 'string') { |
119 | - var icon = false //api.emoji_url('lock') | |
109 … | + var icon = api.emoji_url('lock') | |
120 | 110 … | return icon |
121 | 111 … | ? h('img', {className: 'emoji', src: icon}) |
122 | 112 … | : 'PRIVATE' |
123 | 113 … | } |
modules_core/file-input.js | |||
---|---|---|---|
@@ -3,16 +3,12 @@ | |||
3 | 3 … | var pull = require('pull-stream') | |
4 | 4 … | var mime = require('simple-mime')('application/octect-stream') | |
5 | 5 … | var split = require('split-buffer') | |
6 | 6 … | ||
7 | -var plugs = require('../plugs') | ||
8 | - | ||
9 | -var add = plugs.first(exports.sbot_blobs_add = []) | ||
10 | - | ||
11 | 7 … | module.exports = { | |
12 | 8 … | needs: {sbot_blobs_add: 'first'}, | |
13 | 9 … | gives: 'file_input', | |
14 | - create: function () { | ||
10 … | + create: function (api) { | ||
15 | 11 … | return function FileInput(onAdded) { | |
16 | 12 … | return h('input', { type: 'file', | |
17 | 13 … | onchange: function (ev) { | |
18 | 14 … | var file = ev.target.files[0] | |
@@ -20,9 +16,9 @@ | |||
20 | 16 … | var reader = new FileReader() | |
21 | 17 … | reader.onload = function () { | |
22 | 18 … | pull( | |
23 | 19 … | pull.values(split(new Buffer(reader.result), 64*1024)), | |
24 | - add(function (err, blob) { | ||
20 … | + api.sbot_blobs_add(function (err, blob) { | ||
25 | 21 … | if(err) return console.error(err) | |
26 | 22 … | onAdded({ | |
27 | 23 … | link: blob, | |
28 | 24 … | name: file.name, |
modules_extra/channel.js | ||
---|---|---|
@@ -3,14 +3,8 @@ | ||
3 | 3 … | var pull = require('pull-stream') |
4 | 4 … | var Scroller = require('pull-scroll') |
5 | 5 … | var mfr = require('map-filter-reduce') |
6 | 6 … | |
7 | -//var plugs = require('../plugs') | |
8 | -//var message_render = plugs.first(exports.message_render = []) | |
9 | -//var message_compose = plugs.first(exports.message_compose = []) | |
10 | -//var sbot_log = plugs.first(exports.sbot_log = []) | |
11 | -//var sbot_query = plugs.first(exports.sbot_query = []) | |
12 | - | |
13 | 7 … | exports.needs = { |
14 | 8 … | message_render: 'first', |
15 | 9 … | message_compose: 'first', |
16 | 10 … | sbot_log: 'first', |
Built with git-ssb-web