fix(PageComponent): update onKeyDown event handler to prevent copying text when there is a selection

This commit is contained in:
anovazzi1 2023-12-04 18:10:22 -03:00
commit cd1a290057

View file

@ -90,7 +90,10 @@ export default function Page({
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
if (!isWrappedWithClass(event, "nocopy")) {
if (
!isWrappedWithClass(event, "nocopy") &&
window.getSelection()?.toString().length === 0
) {
if (
(event.ctrlKey || event.metaKey) &&
event.key === "c" &&