From 9f02f313c56b7bb909010628d2931a4aada3a778 Mon Sep 17 00:00:00 2001 From: Melonai Date: Sat, 23 May 2020 02:11:25 +0200 Subject: added back protocol trimming on paste --- client/src/Components/Form.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'client/src/Components/Form.js') diff --git a/client/src/Components/Form.js b/client/src/Components/Form.js index 4d10f98..077cb58 100644 --- a/client/src/Components/Form.js +++ b/client/src/Components/Form.js @@ -11,18 +11,24 @@ function Form(props) { } }; - const handleChange = (e) => { + const handleChange = e => { const userInput = e.target.value; const valid = isURL('https://' + userInput); setState({value: userInput, valid: valid}); }; + const handlePaste = e => { + e.preventDefault(); + const pattern = /^https?:\/\//; + setState({value: e.clipboardData.getData('Text').replace(pattern, ''), valid: false}); + }; + return (
e.preventDefault()}>
https:// - +
-- cgit 1.4.1