From f2707f0161fd98c7f89dba30af49a477a78c0c5b Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 24 Oct 2022 14:53:26 +0200 Subject: [PATCH] update warning & only show once per session --- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 3f38983164..402a888411 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -136,6 +136,7 @@ export const EditorUI = (props: EditorUIProps) => { \t\t\t\t\t\t\t\tMedium: https://medium.com/remix-ide\n \t\t\t\t\t\t\t\tTwitter: https://twitter.com/ethereumremix\n ` + const pasteCodeRef = useRef(false) const editorRef = useRef(null) const monacoRef = useRef(null) const currentFileRef = useRef('') @@ -543,7 +544,7 @@ export const EditorUI = (props: EditorUIProps) => { }) editor.onDidPaste((e) => { - if (e && e.range && e.range.startLineNumber >= 0 && e.range.endLineNumber >= 0 && e.range.endLineNumber - e.range.startLineNumber > 10) { + if (!pasteCodeRef.current && e && e.range && e.range.startLineNumber >= 0 && e.range.endLineNumber >= 0 && e.range.endLineNumber - e.range.startLineNumber > 10) { const modalContent: AlertModal = { id: 'newCodePasted', title: 'New pasted code detected!', @@ -553,17 +554,18 @@ export const EditorUI = (props: EditorUIProps) => {
Please make sure you fully understand this new code before executing any transaction that uses it.
- Your wallet might be exposed and at risk if you run untrusted code. In a worst-case scenario you could loose all your money. + Your wallet might be exposed and at risk if you run untrusted code. In a worst-case scenario you could loose all your money.
- If you don't fully understand it, please don't run this code. + If you don't fully understand it, please don't run this code.
- If you are not a smart contract developer, please ask assistance to someone you trust and has the skills to determine whether this code is safe to use. + If you are not a smart contract developer, please ask assistance to someone you trust and has the appropirate skills to determine whether this code is safe to use.
), } props.plugin.call('notification', 'alert', modalContent) + pasteCodeRef.current = true } })