Disable emoji and sticker pickers if conversation has open panels

This commit is contained in:
Scott Nonnenberg 2019-11-14 18:28:37 -08:00
parent 01bf53776b
commit 0512d08d61
2 changed files with 12 additions and 0 deletions

View File

@ -88,6 +88,12 @@ export const EmojiButton = React.memo(
const { ctrlKey, key, metaKey, shiftKey } = event;
const ctrlOrCommand = metaKey || ctrlKey;
// We don't want to open up if the conversation has any panels open
const panels = document.querySelectorAll('.conversation .panel');
if (panels && panels.length > 1) {
return;
}
if (ctrlOrCommand && shiftKey && (key === 'e' || key === 'E')) {
event.stopPropagation();
event.preventDefault();

View File

@ -154,6 +154,12 @@ export const StickerButton = React.memo(
const { ctrlKey, key, metaKey, shiftKey } = event;
const ctrlOrCommand = metaKey || ctrlKey;
// We don't want to open up if the conversation has any panels open
const panels = document.querySelectorAll('.conversation .panel');
if (panels && panels.length > 1) {
return;
}
if (ctrlOrCommand && shiftKey && (key === 's' || key === 'S')) {
event.stopPropagation();
event.preventDefault();