Skip to content

Commit

Permalink
minor: indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
liady committed Dec 6, 2022
1 parent 0b0abdb commit 97428ad
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions src/content_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,23 @@ function downloadThread({ as = Format.PNG } = {}) {
const pixelRatio = window.devicePixelRatio;
const minRatio = as === Format.PDF ? 2 : 2.5;
window.devicePixelRatio = Math.max(pixelRatio, minRatio);
html2canvas(elements.thread,
{
letterRendering: true,
onclone: function (cloneDoc) {
//Make small fix of position to all the text containers
let listOfTexts = cloneDoc.getElementsByClassName('min-h-[20px]');
Array.from(listOfTexts).forEach((text) => {
text.style.position = 'relative';
text.style.top = '-8px';
});

//Delete copy button from code blocks
let listOfCopyBtns = cloneDoc.querySelectorAll('button.flex');
Array.from(listOfCopyBtns).forEach(
(btn) => (btn.remove())
);
}
}
).then(async function (canvas) {
html2canvas(elements.thread, {
letterRendering: true,
onclone: function (cloneDoc) {
//Make small fix of position to all the text containers
let listOfTexts = cloneDoc.getElementsByClassName("min-h-[20px]");
Array.from(listOfTexts).forEach((text) => {
text.style.position = "relative";
text.style.top = "-8px";
});

//Delete copy button from code blocks
let listOfCopyBtns = cloneDoc.querySelectorAll("button.flex");
Array.from(listOfCopyBtns).forEach(
(btn) => (btn.style.visibility = "hidden")
);
},
}).then(async function (canvas) {
elements.restoreLocation();
window.devicePixelRatio = pixelRatio;
const imgData = canvas.toDataURL("image/png");
Expand Down

0 comments on commit 97428ad

Please sign in to comment.