diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-01-31 13:44:39 -0800 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-01-31 13:45:04 -0800 |
commit | a7040f725b3aef80e717673511556e170d989dd9 (patch) | |
tree | a8cd79981fcc8b5bf931e89a869479e9c16850c1 | |
parent | 1a0532b77bc333454c4fcdcb3d992ca53f56ba16 (diff) | |
download | patchfoo-a7040f725b3aef80e717673511556e170d989dd9.tar.gz patchfoo-a7040f725b3aef80e717673511556e170d989dd9.zip |
Expand compose box to fit previewed text
-rw-r--r-- | lib/serve.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/serve.js b/lib/serve.js index 51a7a5d..e4d5911 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -685,6 +685,10 @@ Serve.prototype.wrapChannel = function (channel) { }) } +function rows(str) { + return String(str).split(/[^\n]{70}|\n/).length +} + Serve.prototype.composer = function (opts, cb) { var self = this opts = opts || {} @@ -697,7 +701,7 @@ Serve.prototype.composer = function (opts, cb) { h('textarea', { id: opts.id, name: 'text', - rows: 4, + rows: Math.max(4, rows(data.text)), cols: 70, placeholder: opts.placeholder || 'public message', }, data.text || ''), |