[Perf] Message / Context Menu: Speed up rendering (#1588)

This commit is contained in:
Alexander Zinchuk 2021-12-14 22:41:03 +04:00
parent b43eab4ccb
commit 35b533045c

View File

@ -30,12 +30,12 @@ export default (
const handleBeforeContextMenu = useCallback((e: React.MouseEvent) => {
if (!isMenuDisabled && e.button === 2) {
document.body.classList.add('no-selection');
(e.target as HTMLElement).classList.add('no-selection');
}
}, [isMenuDisabled]);
const handleContextMenu = useCallback((e: React.MouseEvent) => {
document.body.classList.remove('no-selection');
(e.target as HTMLElement).classList.remove('no-selection');
if (isMenuDisabled || (shouldDisableOnLink && (e.target as HTMLElement).matches('a[href]'))) {
return;