book/html/layout/detail.jsView |
---|
84 | 84 … | ? '-expanded' |
85 | 85 … | : '-contracted' |
86 | 86 … | }) |
87 | 87 … | |
| 88 … | + var getProfileSuggestions = api.about.async.suggest() |
| 89 … | + var getChannelSuggestions = api.channel.async.suggest() |
| 90 … | + var getEmojiSuggestions = api.emoji.async.suggest() |
| 91 … | + |
| 92 … | + let textArea = h('textarea', {'ev-input': e => value.set(e.target.value), value }) |
| 93 … | + |
| 94 … | + let textAreaWrapper = h('span', textArea) |
| 95 … | + |
| 96 … | + addSuggest(textArea, (inputText, cb) => { |
| 97 … | + const char = inputText[0] |
| 98 … | + const wordFragment = inputText.slice(1) |
| 99 … | + |
| 100 … | + if (char === '@') cb(null, getProfileSuggestions(wordFragment)) |
| 101 … | + if (char === '#') cb(null, getChannelSuggestions(wordFragment)) |
| 102 … | + if (char === ':') cb(null, getEmojiSuggestions(wordFragment)) |
| 103 … | + }, {cls: 'PatchSuggest'}) |
| 104 … | + |
88 | 105 … | return h('div', { classList }, [ |
89 | 106 … | h('div', name + ':'), |
90 | 107 … | when(isEditing, |
91 | | - h('textarea', {'ev-input': e => value.set(e.target.value), value }), |
| 108 … | + textAreaWrapper, |
92 | 109 … | computed(value, api.message.html.markdown) |
93 | 110 … | ) |
94 | 111 … | ]) |
95 | 112 … | } |