🐛 Site > Fix download file
This commit is contained in:
@@ -23,6 +23,16 @@ export default
|
||||
return `${this.$store.state.url}/${this.$store.state.projects.current.slug}/files/${this.content.path.full}`
|
||||
},
|
||||
|
||||
downloadDataUri()
|
||||
{
|
||||
if(this.$store.state.files.currentVersion)
|
||||
{
|
||||
return `data:text/plain;charset=utf-8,${encodeURIComponent(this.$store.state.files.currentVersion.content)}`
|
||||
}
|
||||
|
||||
return ''
|
||||
},
|
||||
|
||||
isImage()
|
||||
{
|
||||
return ['jpg', 'jpeg', 'png', 'tiff', 'gif', 'webp'].indexOf(this.content.extension) !== -1
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<!-- Preview -->
|
||||
<div class="preview" v-if="isImage">
|
||||
<div class="inner">
|
||||
<img :src="downloadUrl">
|
||||
<!-- <img :src="downloadUrl"> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<illustration name="sad-robot"></illustration>
|
||||
<div class="text">
|
||||
Sorry, I can't read this file.
|
||||
<br>But you can <a :href="downloadUrl" download class="download">download it</a>.
|
||||
<!-- <br>But you can <a :href="downloadUrl" download class="download">download it</a>. -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -45,10 +45,10 @@
|
||||
<tooltip position="bottom">Copy to clipboard</tooltip>
|
||||
</a>
|
||||
|
||||
<a class="download" :href="downloadUrl" download>
|
||||
<a class="download" :href="downloadDataUri" :download="content.name">
|
||||
<img class="icon default" src="../../../static/svg/download.svg" alt="">
|
||||
<img class="icon hover" src="../../../static/svg/download-hover.svg" alt="">
|
||||
<tooltip position="bottom-left">Download the latest version of the file</tooltip>
|
||||
<tooltip position="bottom-left">Download this version of the file</tooltip>
|
||||
</a>
|
||||
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user