diff options
author | Reverite <github@reverite.sh> | 2019-04-12 01:38:18 -0700 |
---|---|---|
committer | Reverite <github@reverite.sh> | 2019-04-12 01:38:18 -0700 |
commit | e10a9794f4ed7c90e3190f285359f55dd00da435 (patch) | |
tree | 579ebf95d6bbf091d05e66907a9c8168c926e0af /app/javascript/core | |
parent | ff736905fa534f7189e57c1d0c14fbac45f239a1 (diff) | |
parent | bb50ec2e6687238ad8b2ec545a73270fee7a7b09 (diff) |
Merge branch 'glitch' into production
Diffstat (limited to 'app/javascript/core')
-rw-r--r-- | app/javascript/core/settings.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/javascript/core/settings.js b/app/javascript/core/settings.js index af97fb25f..e0cb944e0 100644 --- a/app/javascript/core/settings.js +++ b/app/javascript/core/settings.js @@ -42,14 +42,20 @@ delegate(document, '#account_locked', 'change', ({ target }) => { }); delegate(document, '.input-copy input', 'click', ({ target }) => { + target.focus(); target.select(); + target.setSelectionRange(0, target.value.length); }); delegate(document, '.input-copy button', 'click', ({ target }) => { const input = target.parentNode.querySelector('.input-copy__wrapper input'); + const oldReadOnly = input.readonly; + + input.readonly = false; input.focus(); input.select(); + input.setSelectionRange(0, input.value.length); try { if (document.execCommand('copy')) { @@ -63,4 +69,6 @@ delegate(document, '.input-copy button', 'click', ({ target }) => { } catch (err) { console.error(err); } + + input.readonly = oldReadOnly; }); |