Repository navigation
feat: add /gif slash command for inline GIF search - #110
Conversation
Type /gif in any comment box to browse trending GIFs, or /gif cats to search directly. Selecting a GIF replaces the command text with the image tag. Opt-in via extension options (disabled by default). Closes N1ck#56
9f7e860 to
a595658
Compare
N1ck
left a comment
There was a problem hiding this comment.
Thanks for putting this together! I’m really happy you’ve contributed this, and I’d love to get slash commands in.
I’ve left some comments on cases where comment text could get overwritten or searches could show the wrong results. I’d like to get those sorted before merging so it’s reliable for existing users.
| replacement = `<img src="${gifUrl}"/>`; | ||
| } | ||
|
|
||
| const element = activeElement; |
There was a problem hiding this comment.
A's GIF is inserted into comment B using A's offsets if A's selection is dismissed and a command starts in B while the settings read is delayed. Could we capture the original editor and match and recheck both after the await?
| popup.style.display = 'none'; | ||
| } | ||
|
|
||
| activeElement = undefined; |
There was a problem hiding this comment.
A queued search survives Escape and can replace the results for a command opened in another comment box within the 400 ms delay. Could we cancel the pending debounce when hiding the popup or changing editors?
- Restrict regex to spaces/tabs to avoid matching across lines - Guard against race conditions when switching editors - Cancel stale API responses and debounced searches - Reuse/destroy Masonry instances to prevent listener leaks - Constrain popup to available viewport space - Reposition popup on scroll/resize - Add keyboard navigation (arrow keys + Enter) - Fix CSS lint (rgba → rgb modern syntax)
|
Thanks for the thorough review! All great catches — addressed everything |


Summary
#56
/gifin any comment box to browse trending GIFs/gif catsto search directlyChanges
src/lib/slash-command.js— slash command handlersrc/main.js— conditional initializationsrc/lib/settings.js— addedenableSlashCommandsettingsrc/options.html/src/options.js— toggle checkboxsrc/style.css— floating popup stylesTest plan
/gifshows trending GIFs popup/gif catssearches and shows results/gif cat runningrefines search with debounce<img>tag