forked from mirrors/bookwyrm
Fix js following review
This commit is contained in:
parent
407d471065
commit
57502c1f3c
1 changed files with 13 additions and 6 deletions
|
@ -449,13 +449,20 @@ let BookWyrm = new class {
|
||||||
const copyButtonEl = document.createElement('button');
|
const copyButtonEl = document.createElement('button');
|
||||||
|
|
||||||
copyButtonEl.textContent = textareaEl.dataset.copytextLabel;
|
copyButtonEl.textContent = textareaEl.dataset.copytextLabel;
|
||||||
copyButtonEl.classList.add("mt-2","button","is-small","is-fullwidth","is-primary","is-light");
|
copyButtonEl.classList.add(
|
||||||
|
"mt-2",
|
||||||
|
"button",
|
||||||
|
"is-small",
|
||||||
|
"is-fullwidth",
|
||||||
|
"is-primary",
|
||||||
|
"is-light"
|
||||||
|
);
|
||||||
copyButtonEl.addEventListener('click', () => {
|
copyButtonEl.addEventListener('click', () => {
|
||||||
navigator.clipboard.writeText(text).then(function() {
|
navigator.clipboard.writeText(text).then(function() {
|
||||||
textareaEl.classList.add('is-success');
|
textareaEl.classList.add('is-success');
|
||||||
copyButtonEl.classList.replace('is-primary', 'is-success');
|
copyButtonEl.classList.replace('is-primary', 'is-success');
|
||||||
copyButtonEl.textContent = textareaEl.dataset.copytextSuccess;
|
copyButtonEl.textContent = textareaEl.dataset.copytextSuccess;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
textareaEl.parentNode.appendChild(copyButtonEl)
|
textareaEl.parentNode.appendChild(copyButtonEl)
|
||||||
|
|
Loading…
Reference in a new issue