Skip to content

Commit

Permalink
Merge branch 'develop' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancooley committed Sep 1, 2023
2 parents 5e30cb5 + e46d6cf commit 6f3655b
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions resources/js/components/shared/DownloadSvgButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@

<!-- Used for the design -->
<!-- Page -->
<div ref="modelPrintSection" style="
position: absolute;
z-index: 0;
<div ref="modelPrintSection" id="modelPrintSection" style="
display: none;
position: relative;
color: #000;
min-width: 90em;
left: -9999999px;
padding: 1rem;
background: #ffffff;
text-transform: initial;
Expand Down Expand Up @@ -55,7 +54,7 @@
background: #ffffff;
">
<div class="w-50 p-3" style="background: #E5F1FF; border-radius: 8px 0 0 8px"><h5><b>{{ title }}</b></h5></div>
<div class="w-50 p-3 text-muted" style="border-radius: 0 8px 8px 0"><small>{{ description }}</small></div>
<div class="w-50 p-3 text-muted" style="border-radius: 0 8px 8px 0"><small>{{ prompt }}</small></div>
</div>
</div>
</div>
Expand All @@ -80,6 +79,10 @@ export default {
type: String,
default: "",
},
prompt: {
type: String,
default: "",
},
requestDate: {
type: String,
default: "",
Expand Down Expand Up @@ -108,22 +111,26 @@ export default {
async download(event) {
this.isLoading = true;
const el = this.$refs.modelPrintSection;
const options = {
type: "dataURL",
};
this.img = await this.$html2canvas(el, options);
const dataURL = this.img;
this.$html2canvas(el, {
type: "dataURL",
onclone(clone) {
clone.getElementById("modelPrintSection").style.display = "block";
},
}).then((canvas) => {
this.img = canvas;
const dataURL = this.img;
const downloadLink = document.createElement("a");
downloadLink.href = dataURL;
downloadLink.download = `${this.fileName}.png`;
const downloadLink = document.createElement("a");
downloadLink.href = dataURL;
downloadLink.download = `${this.fileName}.png`;
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
this.isLoading = false;
document.body.removeChild(downloadLink);
this.isLoading = false;
});
},
async convertImagesToBase64(svgString) {
Expand Down

0 comments on commit 6f3655b

Please sign in to comment.