diff options
author | ThibG <thib@sitedethib.com> | 2019-04-04 15:13:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-04 15:13:18 +0200 |
commit | 30500dff7cbf27fbee6eb45e20cc24ca0b7a9e77 (patch) | |
tree | e6022023d42dde628bb44880659104a87f985039 /app/javascript/core/settings.js | |
parent | 14bad3f472b2d9887db701409db93e511e9c6f50 (diff) | |
parent | be6885eb93c088699465d1c50e49e8ba6d9fa3a7 (diff) |
Merge pull request #981 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/core/settings.js')
-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; }); |