fix(PageComponent): update onKeyDown event handler to prevent copying text when there is a selection
This commit is contained in:
parent
11c9515e19
commit
cd1a290057
1 changed files with 4 additions and 1 deletions
|
|
@ -90,7 +90,10 @@ export default function Page({
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onKeyDown = (event: KeyboardEvent) => {
|
const onKeyDown = (event: KeyboardEvent) => {
|
||||||
if (!isWrappedWithClass(event, "nocopy")) {
|
if (
|
||||||
|
!isWrappedWithClass(event, "nocopy") &&
|
||||||
|
window.getSelection()?.toString().length === 0
|
||||||
|
) {
|
||||||
if (
|
if (
|
||||||
(event.ctrlKey || event.metaKey) &&
|
(event.ctrlKey || event.metaKey) &&
|
||||||
event.key === "c" &&
|
event.key === "c" &&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue