aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/serve.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 7879377..2f96d57 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -989,6 +989,14 @@ Serve.prototype.composer = function (opts, cb) {
formNames[mentionNames[i]] = u.extractFeedIds(mentionIds[i])[0]
}
+ if (data.upload) {
+ // TODO: be able to change the content-type
+ var isImage = /^image\//.test(data.upload.type)
+ data.text = (data.text ? data.text + '\n' : '')
+ + (isImage ? '!' : '')
+ + '[' + data.upload.name + '](' + data.upload.link + ')'
+ }
+
var done = multicb({pluck: 1, spread: true})
done()(null, h('section.composer',
h('form', {method: 'post', action: opts.id ? '#' + opts.id : '',
@@ -1011,8 +1019,7 @@ Serve.prototype.composer = function (opts, cb) {
h('table.ssb-msgs',
h('tr.msg-row',
h('td.msg-left', {colspan: 2},
- h('input', {type: 'file', name: 'upload'}), ' ',
- h('input', {type: 'submit', name: 'action', value: 'attach'})
+ h('input', {type: 'file', name: 'upload'})
),
h('td.msg-right',
h('input', {type: 'submit', name: 'action', value: 'raw'}), ' ',
@@ -1020,12 +1027,6 @@ Serve.prototype.composer = function (opts, cb) {
)
)
),
- data.upload ? [
- h('div', h('em', 'attach:')),
- h('code', '[' + data.upload.name + '](' + data.upload.link + ')'), ' ',
- h('input', {name: 'blob_link', value: data.upload.link, type: 'hidden'}),
- h('input', {name: 'blob_type', value: data.upload.type})
- ] : '',
data.action === 'preview' ? preview(false, done()) :
data.action === 'raw' ? preview(true, done()) : ''
)