diff --git a/src/index.html b/src/index.html index 6084296..2fc2159 100644 --- a/src/index.html +++ b/src/index.html @@ -59,16 +59,16 @@ --> -
+ - + - +
diff --git a/src/main.js b/src/main.js index 273f3e4..5c001da 100644 --- a/src/main.js +++ b/src/main.js @@ -579,6 +579,19 @@ importBtn.addEventListener('click', () => { }); settingsForm.addEventListener('input', () => validKeys(privateKeyInput.value, pubKeyInput.value)); +privateKeyInput.addEventListener('paste', (event) => { + if (pubKeyInput.value || !event.clipboardData) { + return; + } + if (privateKeyInput.value === '' || ( + privateKeyInput.selectionStart === 0 + && privateKeyInput.selectionEnd === privateKeyInput.value.length + )) { + try { + pubKeyInput.value = getPublicKey(event.clipboardData.getData('text')); + } catch(err) {} // settings form will call validKeys on input and display the error + } +}); function validKeys(privatekey, pubkey) { try {