feat: Filtre les boutons
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Simon 2023-05-03 17:38:21 +02:00
parent c85fdc8d27
commit 4c3d796b17
1 changed files with 9 additions and 7 deletions

View File

@ -138,9 +138,15 @@ const saveAs = (blob, fileName) => {
const sharing = ref(false);
async function share() {
sharing.value = true;
const filter = (node) => {
const exclusionClasses = ["btn"];
return !exclusionClasses.some((classname) =>
node.classList?.contains(classname)
);
};
const body = document.querySelector("body");
body.classList.add("print");
const dataUrl = await toPng(body);
const dataUrl = await toPng(body, { filter: filter });
body.classList.remove("print");
saveAs(dataUrl, "my-node.png");
sharing.value = false;
@ -197,11 +203,7 @@ async function share() {
</li>
</ul>
</div>
<button
class="btn download no-print"
@click="() => share()"
v-if="!sharing"
>
<button class="btn download" @click="() => share()" v-if="!sharing">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36">
<path
fill="#D99E82"
@ -221,7 +223,7 @@ async function share() {
/>
</svg>
</button>
<button class="btn spin no-print" v-if="sharing">
<button class="btn spin" v-if="sharing">
<img src="/spin.svg" />
</button>
</div>