Commit a9cc9aea4520bfc78aaef9eb1a019aaedaebdebe
quote example
Anders Rune Jensen committed on 4/14/2018, 7:56:33 PMParent: 6151ce3e3718887750c939a25d0dec1f7d140794
Files changed
message/html/compose.js | changed |
message/html/action/quote.js | added |
message/html/compose.js | ||
---|---|---|
@@ -144,8 +144,23 @@ | ||
144 | 144 … | warning, |
145 | 145 … | actions |
146 | 146 … | ]) |
147 | 147 … | |
148 … | + composer.addQuote = function (data) { | |
149 … | + try { | |
150 … | + if (typeof data.content.text === 'string') { | |
151 … | + var text = data.content.text | |
152 … | + textArea.value += '> ' + text.replace(/\r\n|\r|\n/g,'\n> ') + '\r\n\n' | |
153 … | + hasContent.set(!!textArea.value) | |
154 … | + } | |
155 … | + } catch(err) { | |
156 … | + // object not have text or content | |
157 … | + } | |
158 … | + } | |
159 … | + | |
160 … | + if (location.action == 'quote') | |
161 … | + composer.addQuote(location.value) | |
162 … | + | |
148 | 163 … | addSuggest(channelInput, (inputText, cb) => { |
149 | 164 … | if (inputText[0] === '#') { |
150 | 165 … | cb(null, getChannelSuggestions(inputText.slice(1))) |
151 | 166 … | } |
message/html/action/quote.js | ||
---|---|---|
@@ -1,0 +1,17 @@ | ||
1 … | +var h = require('mutant/h') | |
2 … | +var nest = require('depnest') | |
3 … | + | |
4 … | +exports.needs = nest({ | |
5 … | + 'app.sync.goTo': 'first' | |
6 … | +}) | |
7 … | + | |
8 … | +exports.gives = nest('message.html.action') | |
9 … | + | |
10 … | +exports.create = (api) => { | |
11 … | + return nest('message.html.action', function reply (msg) { | |
12 … | + return h('a', { | |
13 … | + href: '#', | |
14 … | + 'ev-click': () => api.app.sync.goTo({ action: 'quote', key: msg.key, value: msg.value }) | |
15 … | + }, 'Quote') | |
16 … | + }) | |
17 … | +} |
Built with git-ssb-web