mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-28 11:00:36 +00:00
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');
|
||||
|
||||
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', () => {
|
||||
navigator.clipboard.writeText(text).then(function() {
|
||||
textareaEl.classList.add('is-success');
|
||||
copyButtonEl.classList.replace('is-primary', 'is-success');
|
||||
copyButtonEl.textContent = textareaEl.dataset.copytextSuccess;
|
||||
});
|
||||
navigator.clipboard.writeText(text).then(function() {
|
||||
textareaEl.classList.add('is-success');
|
||||
copyButtonEl.classList.replace('is-primary', 'is-success');
|
||||
copyButtonEl.textContent = textareaEl.dataset.copytextSuccess;
|
||||
});
|
||||
});
|
||||
|
||||
textareaEl.parentNode.appendChild(copyButtonEl)
|
||||
|
|
Loading…
Reference in a new issue