diff --git a/components/CustomContextMenu.js b/components/CustomContextMenu.js index 43adac7c..ff0dc313 100644 --- a/components/CustomContextMenu.js +++ b/components/CustomContextMenu.js @@ -103,18 +103,18 @@ export default function CustomContextMenu(props) { /** * 复制内容 */ - function handleCopy(){ - var selectedText = document.getSelection().toString(); + function handleCopy() { + const selectedText = document.getSelection().toString(); if (selectedText) { - var tempInput = document.createElement("input"); - tempInput.value = selectedText; - document.body.appendChild(tempInput); - tempInput.select(); - document.execCommand("copy"); - document.body.removeChild(tempInput); - // alert("Text copied: " + selectedText); + const tempInput = document.createElement('input'); + tempInput.value = selectedText; + document.body.appendChild(tempInput); + tempInput.select(); + document.execCommand('copy'); + document.body.removeChild(tempInput); + // alert("Text copied: " + selectedText); } else { - // alert("Please select some text first."); + // alert("Please select some text first."); } setShow(false) @@ -178,7 +178,7 @@ export default function CustomContextMenu(props) {
{locale.MENU.COPY}
- )} + )}
@@ -194,8 +194,8 @@ export default function CustomContextMenu(props) {
{locale.MENU.THEME_SWITCH}
- )} - + )} +