Skip to content

Commit

Permalink
Merge branch 'closure-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyestein committed Dec 31, 2023
2 parents a42065d + 5665126 commit 12cb7a9
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,8 @@ function makeCopyButtons() {
var item = dataItemFromBI(bi);
var butt = document.createElement('BUTTON');
butt.className = copy_button_class;
// I'm not sure why this mess is needed, but I was previously getting
// every button copying the *last* value copyString had in the loop.
function onclickgen(copyStr) {
function onclickinner() {
navigator.clipboard.writeText(copyStr);
}
return onclickinner;
}
let copyString = formatItemAsStr(item);
butt.onclick = onclickgen(copyString);
butt.onclick = () => { navigator.clipboard.writeText(copyString); };
butt.innerHTML = 'Copy';
bi.prepend(butt);
}
Expand Down

0 comments on commit 12cb7a9

Please sign in to comment.