[Perf] Message / Context Menu: Speed up rendering (#1588)
This commit is contained in:
parent
b43eab4ccb
commit
35b533045c
@ -30,12 +30,12 @@ export default (
|
|||||||
|
|
||||||
const handleBeforeContextMenu = useCallback((e: React.MouseEvent) => {
|
const handleBeforeContextMenu = useCallback((e: React.MouseEvent) => {
|
||||||
if (!isMenuDisabled && e.button === 2) {
|
if (!isMenuDisabled && e.button === 2) {
|
||||||
document.body.classList.add('no-selection');
|
(e.target as HTMLElement).classList.add('no-selection');
|
||||||
}
|
}
|
||||||
}, [isMenuDisabled]);
|
}, [isMenuDisabled]);
|
||||||
|
|
||||||
const handleContextMenu = useCallback((e: React.MouseEvent) => {
|
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]'))) {
|
if (isMenuDisabled || (shouldDisableOnLink && (e.target as HTMLElement).matches('a[href]'))) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user