Fix copy-to-clipboard for password case
Change-Id: I9dcb320f1cb482466dba7d90863bd90157753b51
diff --git a/dev/js/src/util.js b/dev/js/src/util.js
index 86e6214..c13ba3d 100644
--- a/dev/js/src/util.js
+++ b/dev/js/src/util.js
@@ -120,9 +120,17 @@
const a = document.createElement('a');
a.classList.add('copy-to-clipboard');
a.addEventListener('click', function () {
+ let back = false;
+ if (text.getAttribute("type") === 'password') {
+ text.setAttribute("type", "text");
+ back = true;
+ };
text.select();
text.setSelectionRange(0, 99999);
document.execCommand("copy");
+ if (back) {
+ text.setAttribute("type", "password");
+ };
});
text.parentNode.insertBefore(a, text.nextSibling);
};