git ssb

16+

Dominic / patchbay



Commit a9cc9aea4520bfc78aaef9eb1a019aaedaebdebe

quote example

Anders Rune Jensen committed on 4/14/2018, 7:56:33 PM
Parent: 6151ce3e3718887750c939a25d0dec1f7d140794

Files changed

message/html/compose.jschanged
message/html/action/quote.jsadded
message/html/compose.jsView
@@ -144,8 +144,23 @@
144144 warning,
145145 actions
146146 ])
147147
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 +
148163 addSuggest(channelInput, (inputText, cb) => {
149164 if (inputText[0] === '#') {
150165 cb(null, getChannelSuggestions(inputText.slice(1)))
151166 }
message/html/action/quote.jsView
@@ -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