Skip to content

Commit

Permalink
Fix keyboard shortcut for "Insert GIF" (#1013)
Browse files Browse the repository at this point in the history
  • Loading branch information
aude authored and sindresorhus committed Sep 8, 2019
1 parent b44a3fb commit dc11fab
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,15 @@ ipc.on('search', () => {
});

ipc.on('insert-gif', () => {
document.querySelector<HTMLElement>('._yht')!.click();
const gifElement =
// Old UI
document.querySelector<HTMLElement>('._yht') ||
// New UI
[...document.querySelectorAll<HTMLElement>('._7oam')].find(element =>
element.querySelector<HTMLElement>('svg path[d^="M27.002,13.5"]')
);

gifElement!.click();
});

ipc.on('insert-emoji', async () => {
Expand Down

0 comments on commit dc11fab

Please sign in to comment.