Commit 5dcb2e47e47030dca8e1317520628cf4526c217b
Merge master
Anders Rune Jensen committed on 6/7/2018, 6:25:03 PMParent: 06d5f9edff08206becab379b2f89c78d0d066da5
Parent: 3957df45eb7c39662cabc9816064d7e2ef1eb664
Files changed
app/html/filter.js | changed |
app/html/search-bar.js | changed |
app/page/settings.js | changed |
app/sync/initialise/suggestionCaches.js | added |
message/html/compose.js | changed |
package-lock.json | changed |
package.json | changed |
app/html/filter.js | ||
---|---|---|
@@ -140,12 +140,11 @@ | ||
140 | 140 … | h('i', { classList: when(state, 'fa fa-check-square-o', 'fa fa-square-o') }) |
141 | 141 … | ]) |
142 | 142 … | } |
143 | 143 … | |
144 | - const getChannelSuggestions = api.channel.async.suggest() | |
145 | 144 … | addSuggest(channelInput, (inputText, cb) => { |
146 | 145 … | if (inputText[0] === '#') { |
147 | - cb(null, getChannelSuggestions(inputText.slice(1))) | |
146 … | + api.channel.async.suggest(inputText.slice(1), cb) | |
148 | 147 … | } |
149 | 148 … | }, {cls: 'PatchSuggest'}) |
150 | 149 … | channelInput.addEventListener('suggestselect', ev => { |
151 | 150 … | const channels = channelInput.value.trim() |
@@ -154,12 +153,11 @@ | ||
154 | 153 … | |
155 | 154 … | draw() |
156 | 155 … | }) |
157 | 156 … | |
158 | - const getAboutSuggestions = api.about.async.suggest() | |
159 | 157 … | addSuggest(userInput, (inputText, cb) => { |
160 | 158 … | inputText = inputText.replace(/^@/, '') |
161 | - cb(null, getAboutSuggestions(inputText)) | |
159 … | + api.about.async.suggest(inputText, cb) | |
162 | 160 … | }, {cls: 'PatchSuggest'}) |
163 | 161 … | userInput.addEventListener('suggestselect', ev => userId.set(ev.detail.id)) |
164 | 162 … | |
165 | 163 … | function followFilter (msg) { |
app/html/search-bar.js | ||
---|---|---|
@@ -16,13 +16,14 @@ | ||
16 | 16 … | |
17 | 17 … | return nest('app.html.searchBar', function searchBar () { |
18 | 18 … | if (_search) return _search |
19 | 19 … | |
20 | - const getProfileSuggestions = api.about.async.suggest() | |
21 | - const getChannelSuggestions = api.channel.async.suggest() | |
22 | - | |
23 | 20 … | function goToLocation (location, ev) { |
24 | - if (location[0] == '?') { location = { page: 'search', query: location.substring(1) } } else if (!['@', '#', '%', '&', '/'].includes(location[0])) { location = { page: 'search', query: location } } | |
21 … | + if (location[0] === '?') { | |
22 … | + location = { page: 'search', query: location.substring(1) } | |
23 … | + } else if (!['@', '#', '%', '&', '/'].includes(location[0])) { | |
24 … | + location = { page: 'search', query: location } | |
25 … | + } | |
25 | 26 … | |
26 | 27 … | api.app.sync.goTo(location) |
27 | 28 … | if (!ev.ctrlKey) input.blur() |
28 | 29 … | } |
@@ -32,9 +33,9 @@ | ||
32 | 33 … | placeholder: '?search, @name, #channel', |
33 | 34 … | 'ev-keyup': ev => { |
34 | 35 … | switch (ev.keyCode) { |
35 | 36 … | case 13: // enter |
36 | - goToLocation(input.value.trim(), ev) | |
37 … | + goToLocation(input.value.trim(), ev) | |
37 | 38 … | return |
38 | 39 … | case 27: // escape |
39 | 40 … | ev.preventDefault() |
40 | 41 … | input.blur() |
@@ -63,18 +64,18 @@ | ||
63 | 64 … | addSuggest(input, (inputText, cb) => { |
64 | 65 … | const char = inputText[0] |
65 | 66 … | const word = inputText.slice(1) |
66 | 67 … | |
67 | - if (char === '@') cb(null, getProfileSuggestions(word)) | |
68 | - if (char === '#') cb(null, getChannelSuggestions(word)) | |
68 … | + if (char === '@') api.about.async.suggest(word, cb) | |
69 … | + if (char === '#') api.channel.async.suggest(word, cb) | |
69 | 70 … | if (char === '/') cb(null, getPagesSuggestions(word)) |
70 | 71 … | }, {cls: 'PatchSuggest'}) |
71 | 72 … | |
72 | 73 … | // TODO extract |
73 | 74 … | function getPagesSuggestions (word) { |
74 | 75 … | const pages = [ |
75 | 76 … | 'public', 'private', 'inbox', 'profile', 'notifications', 'settings', |
76 | - 'gatherings', 'chess', 'books' | |
77 … | + 'gatherings', 'chess', 'books', 'imageSearch', 'polls' | |
77 | 78 … | ] |
78 | 79 … | |
79 | 80 … | return pages |
80 | 81 … | .filter(page => ~page.indexOf(word)) |
app/page/settings.js | ||
---|---|---|
@@ -14,9 +14,9 @@ | ||
14 | 14 … | |
15 | 15 … | exports.create = function (api) { |
16 | 16 … | return nest({ |
17 | 17 … | 'app.html.menuItem': menuItem, |
18 | - 'app.page.settings': publicPage | |
18 … | + 'app.page.settings': settingsPage | |
19 | 19 … | }) |
20 | 20 … | |
21 | 21 … | function menuItem () { |
22 | 22 … | return h('a', { |
@@ -24,9 +24,10 @@ | ||
24 | 24 … | 'ev-click': () => api.app.sync.goTo({ page: 'settings' }) |
25 | 25 … | }, '/settings') |
26 | 26 … | } |
27 | 27 … | |
28 | - function publicPage (location) { | |
28 … | + | |
29 … | + function settingsPage (location) { | |
29 | 30 … | var page = h('SettingsPage', { title: '/settings' }, [ |
30 | 31 … | h('div.container', [ |
31 | 32 … | h('h1', 'Settings'), |
32 | 33 … | api.app.html.settings().map(setting => { |
app/sync/initialise/suggestionCaches.js | |||
---|---|---|---|
@@ -1,0 +1,17 @@ | |||
1 … | +const nest = require('depnest') | ||
2 … | + | ||
3 … | +exports.gives = nest('app.sync.initialise') | ||
4 … | + | ||
5 … | +exports.needs = nest({ | ||
6 … | + 'about.async.suggest': 'first', | ||
7 … | + 'channel.async.suggest': 'first' | ||
8 … | +}) | ||
9 … | + | ||
10 … | +exports.create = function (api) { | ||
11 … | + return nest('app.sync.initialise', init) | ||
12 … | + | ||
13 … | + function init () { | ||
14 … | + api.about.async.suggest() | ||
15 … | + api.channel.async.suggest() | ||
16 … | + } | ||
17 … | +} |
message/html/compose.js | ||
---|---|---|
@@ -9,8 +9,9 @@ | ||
9 | 9 … | exports.needs = nest({ |
10 | 10 … | 'about.async.suggest': 'first', |
11 | 11 … | 'channel.async.suggest': 'first', |
12 | 12 … | 'emoji.async.suggest': 'first', |
13 … | + 'meme.async.suggest': 'first', | |
13 | 14 … | 'blob.html.input': 'first', |
14 | 15 … | 'message.html.confirm': 'first', |
15 | 16 … | 'drafts.sync.get': 'first', |
16 | 17 … | 'drafts.sync.set': 'first', |
@@ -40,12 +41,8 @@ | ||
40 | 41 … | var textAreaFocused = Value(false) |
41 | 42 … | var focused = computed([channelInputFocused, textAreaFocused], (a, b) => a || b) |
42 | 43 … | var hasContent = Value(false) |
43 | 44 … | |
44 | - var getProfileSuggestions = api.about.async.suggest() | |
45 | - var getChannelSuggestions = api.channel.async.suggest() | |
46 | - var getEmojiSuggestions = api.emoji.async.suggest() | |
47 | - | |
48 | 45 … | var blurTimeout = null |
49 | 46 … | |
50 | 47 … | var expanded = computed([shrink, focused, hasContent], (shrink, focused, hasContent) => { |
51 | 48 … | if (!shrink || hasContent) return true |
@@ -153,22 +150,23 @@ | ||
153 | 150 … | composer.addQuote = function (data) { |
154 | 151 … | try { |
155 | 152 … | if (typeof data.content.text === 'string') { |
156 | 153 … | var text = data.content.text |
157 | - textArea.value += '> ' + text.replace(/\r\n|\r|\n/g,'\n> ') + '\r\n\n' | |
154 … | + textArea.value += '> ' + text.replace(/\r\n|\r|\n/g, '\n> ') + '\r\n\n' | |
158 | 155 … | hasContent.set(!!textArea.value) |
159 | 156 … | } |
160 | - } catch(err) { | |
157 … | + } catch (err) { | |
161 | 158 … | // object not have text or content |
162 | 159 … | } |
163 | 160 … | } |
164 | 161 … | |
165 | - if (location.action == 'quote') | |
162 … | + if (location.action == 'quote') { | |
166 | 163 … | composer.addQuote(location.value) |
164 … | + } | |
167 | 165 … | |
168 | 166 … | addSuggest(channelInput, (inputText, cb) => { |
169 | 167 … | if (inputText[0] === '#') { |
170 | - cb(null, getChannelSuggestions(inputText.slice(1))) | |
168 … | + cb(null, api.channel.async.suggest(inputText.slice(1))) | |
171 | 169 … | } |
172 | 170 … | }, {cls: 'PatchSuggest'}) |
173 | 171 … | channelInput.addEventListener('suggestselect', ev => { |
174 | 172 … | channelInput.value = ev.detail.id // HACK : this over-rides the markdown value |
@@ -177,11 +175,12 @@ | ||
177 | 175 … | addSuggest(textArea, (inputText, cb) => { |
178 | 176 … | const char = inputText[0] |
179 | 177 … | const wordFragment = inputText.slice(1) |
180 | 178 … | |
181 | - if (char === '@') cb(null, getProfileSuggestions(wordFragment, feedIdsInThread)) | |
182 | - if (char === '#') cb(null, getChannelSuggestions(wordFragment)) | |
183 | - if (char === ':') cb(null, getEmojiSuggestions(wordFragment)) | |
179 … | + if (char === '@') api.about.async.suggest(wordFragment, feedIdsInThread, cb) | |
180 … | + if (char === '#') api.channel.async.suggest(wordFragment, cb) | |
181 … | + if (char === ':') api.emoji.async.suggest(wordFragment, cb) | |
182 … | + if (char === '&') api.meme.async.suggest(wordFragment, cb) | |
184 | 183 … | }, {cls: 'PatchSuggest'}) |
185 | 184 … | |
186 | 185 … | return composer |
187 | 186 … |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 360509 bytes New file size: 357422 bytes |
package.json | ||
---|---|---|
@@ -60,9 +60,9 @@ | ||
60 | 60 … | "patch-history": "^1.0.0", |
61 | 61 … | "patch-hub": "^1.1.0", |
62 | 62 … | "patch-inbox": "^1.0.2", |
63 | 63 … | "patch-settings": "^1.1.1", |
64 | - "patch-suggest": "^1.1.0", | |
64 … | + "patch-suggest": "^2.0.1", | |
65 | 65 … | "patchbay-book": "^1.0.6", |
66 | 66 … | "patchbay-gatherings": "^2.0.0", |
67 | 67 … | "patchbay-poll": "^1.0.1", |
68 | 68 … | "patchcore": "^1.27.1", |
@@ -72,13 +72,13 @@ | ||
72 | 72 … | "pull-scroll": "^1.0.9", |
73 | 73 … | "pull-stream": "^3.6.8", |
74 | 74 … | "read-directory": "^2.1.1", |
75 | 75 … | "require-style": "^1.0.1", |
76 | - "scuttle-blog": "^1.0.0", | |
76 … | + "scuttle-blog": "^1.0.1", | |
77 | 77 … | "scuttlebot": "^11.3.0", |
78 | 78 … | "setimmediate": "^1.0.5", |
79 | - "ssb-about": "^0.1.1", | |
80 | - "ssb-backlinks": "^0.6.1", | |
79 … | + "ssb-about": "^0.1.2", | |
80 … | + "ssb-backlinks": "^0.7.1", | |
81 | 81 … | "ssb-blobs": "^1.1.3", |
82 | 82 … | "ssb-chess": "^2.2.4", |
83 | 83 … | "ssb-chess-db": "^1.0.2", |
84 | 84 … | "ssb-client": "^4.5.7", |
@@ -89,9 +89,9 @@ | ||
89 | 89 … | "ssb-meme": "^1.0.4", |
90 | 90 … | "ssb-mentions": "^0.4.1", |
91 | 91 … | "ssb-mutual": "^0.1.0", |
92 | 92 … | "ssb-private": "^0.2.1", |
93 | - "ssb-query": "^1.0.2", | |
93 … | + "ssb-query": "^2.1.0", | |
94 | 94 … | "ssb-search": "^1.0.1", |
95 | 95 … | "ssb-ws": "^1.0.3", |
96 | 96 … | "style-resolve": "^1.0.1", |
97 | 97 … | "suggest-box": "^2.2.3", |
Built with git-ssb-web