()
| 271 | searchInput.addEventListener('keydown', cmdKeydown, { capture: true }); |
| 272 | |
| 273 | function cmdInput() { |
| 274 | if (searchInput.value === '') { |
| 275 | initDom(); |
| 276 | } |
| 277 | |
| 278 | if (window.__CHAT_MODEL_STATUS__) return; |
| 279 | |
| 280 | const query = searchInput.value; |
| 281 | if (!query || !/^\//.test(query)) { |
| 282 | initDom(); |
| 283 | return; |
| 284 | } |
| 285 | |
| 286 | // all cmd result |
| 287 | if (query === '/') { |
| 288 | renderList(data); |
| 289 | return; |
| 290 | } |
| 291 | |
| 292 | const result = data.filter(i => new RegExp(query.substring(1)).test(i.cmd)); |
| 293 | if (result.length > 0) { |
| 294 | renderList(result); |
| 295 | } else { |
| 296 | initDom(); |
| 297 | } |
| 298 | } |
| 299 | searchInput.removeEventListener('input', cmdInput); |
| 300 | searchInput.addEventListener('input', cmdInput); |
| 301 | } |
nothing calls this directly
no test coverage detected