git ssb

16+

Dominic / patchbay



Commit bddebc2c1c0600b889bc609f0f07eba6087ce56f

hide compose controls when textarea is not focused

Dominic Tarr committed on 6/20/2016, 2:59:33 AM
Parent: b5c29f60805936095ac67ab8d047006f7de94d56

Files changed

modules/compose.jschanged
modules/compose.jsView
@@ -14,30 +14,31 @@
1414 var file_input = plugs.first(exports.file_input = [])
1515
1616 exports.suggest = []
1717
18-//this decorator expects to be the first
19-
2018 function id (e) { return e }
2119
2220 exports.message_compose = function (meta, prepublish, cb) {
2321 if('function' !== typeof prepublish)
2422 sbot = prepublish, prepublish = id
23+ var accessories
2524 meta = meta || {}
2625 if(!meta.type) throw new Error('message must have type')
2726 var ta = h('textarea')
2827
2928 var blur
3029 ta.addEventListener('focus', function () {
3130 clearTimeout(blur)
3231 ta.style.height = '200px'
32+ accessories.style.display = 'block'
3333 })
3434 ta.addEventListener('blur', function () {
3535 //don't shrink right away, so there is time
3636 //to click the publish button.
3737 clearTimeout(blur)
3838 blur = setTimeout(function () {
3939 ta.style.height = '50px'
40+ accessories.style.display = 'none'
4041 }, 200)
4142 })
4243
4344 ta.addEventListener('keydown', function (ev) {
@@ -62,9 +63,11 @@
6263
6364
6465 var composer =
6566 h('div', h('div.column', ta,
66- h('div.row',
67+ accessories = h('div.row',
68+ //hidden until you focus the textarea
69+ {style: {display: 'none'}},
6770 file_input(function (file) {
6871 files.push(file)
6972
7073 var embed = file.type.indexOf('image/') === 0 ? '!' : ''
@@ -94,4 +97,5 @@
9497 return composer
9598
9699 }
97100
101+

Built with git-ssb-web