git ssb

16+

Dominic / patchbay



Commit 558b11e7e152891f436d17180335e54c3701aa6b

Fixes inconsistent behavior

These changes help improve the consistency of the new channel-input
The compose box now stays open when left empty and inputing a channel.
The # sigil is added if it's not the first character inputted and is
kept after confirming a suggestion.
Bradley Donahue committed on 2/5/2017, 7:06:27 PM
Parent: 9429dd07ea740e2d002c966affa5cdaccc0d73f3

Files changed

modules_basic/compose.jschanged
modules_basic/compose.mcsschanged
modules_extra/channel.jschanged
modules_basic/compose.jsView
@@ -49,11 +49,22 @@
4949 })
5050
5151 var channelInput = h('input.channel', {
5252 placeholder: '#channel',
53- value: meta.channel || ''
53 + value: meta.channel ? `#${meta.channel}` : '',
54 + disabled: meta.channel ? true : false
5455 })
5556
57 + channelInput.addEventListener('keydown', function (e) {
58 + console.log(e)
59 + if (this.value.startsWith('#') && this.value.length === 1) {
60 + this.value = ''
61 + return
62 + }
63 + if (this.value.startsWith('#')) return
64 + this.value = `#${this.value}`
65 + })
66 +
5667 if(opts.shrink !== false) {
5768 var blur
5869 textArea.addEventListener('focus', () => {
5970 clearTimeout(blur)
@@ -69,8 +80,21 @@
6980 if(textArea.value) return
7081 composer.className = 'Compose -contracted'
7182 }, 300)
7283 })
84 + channelInput.addEventListener('focus', () => {
85 + clearTimeout(blur)
86 + if (!textArea.value) {
87 + composer.className = 'Compose -expanded'
88 + }
89 + })
90 + channelInput.addEventListener('blur', () => {
91 + clearTimeout(blur)
92 + blur = setTimeout(() => {
93 + if (textArea.value || channelInput.value) return
94 + composer.className = 'Compose -contracted'
95 + }, 300)
96 + })
7397 }
7498
7599 textArea.addEventListener('keydown', ev => {
76100 if(ev.keyCode === 13 && ev.ctrlKey) publish()
modules_basic/compose.mcssView
@@ -10,8 +10,14 @@
1010
1111 input.channel {
1212 border: 1px solid gainsboro
1313 padding: .5rem
14 + margin-top: 1rem
15 +
16 + :disabled {
17 + background-color: #e5e5e5
18 + cursor: not-allowed
19 + }
1420 }
1521
1622 section.actions {
1723 display: flex
modules_extra/channel.jsView
@@ -153,9 +153,9 @@
153153 var name = `#${chan.name}`
154154 return {
155155 title: name,
156156 subtitle: `(${chan.rank})`,
157- value: name.substr(1)
157 + value: `#${name.substr(1)}`
158158 }
159159 }))
160160 }
161161 }

Built with git-ssb-web