Changeset 35384 for main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/TranscriptionItem.vue
- Timestamp:
- 2021-09-14T11:13:37+12:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/TranscriptionItem.vue
r35355 r35384 8 8 9 9 <span>{{ translations.get("TranscriptionItem_FileName") }}: {{ transcription.fileName }}</span> 10 11 <button @click="downloadAsText" type="button"> 12 <span class="material-icons">download</span> 13 <span>{{ translations.get("TranscriptionItem_DownloadAsText") }}</span> 14 </button> 10 15 11 16 <button class="theme-error" @click="remove" type="button"> … … 36 41 display: grid; 37 42 gap: 0.5em 0.5em; 38 grid-template-columns: auto 1fr auto ;43 grid-template-columns: auto 1fr auto auto; 39 44 align-items: center; 40 45 … … 52 57 <script> 53 58 import { mapState } from "vuex"; 59 import { saveAs } from "file-saver" 54 60 import TranscriptionItemEditor from "./TranscriptionItemEditor.vue" 55 61 import { TranscriptionViewModel } from "../main"; … … 85 91 // Start our removal animation and give it some time to complete 86 92 Util.delay(550).then(() => this.$store.commit("transcriptionRemove", this.transcription.id)); 93 }, 94 downloadAsText() { 95 const extensionIndex = this.transcription.fileName.lastIndexOf("."); 96 let fileName = this.transcription.fileName.slice(0, extensionIndex); 97 fileName += "_transcription.txt"; 98 99 const blob = new Blob([ this.transcription.transcription ], { type: "text/plain;charset=utf-8" }); 100 saveAs(blob, fileName); 87 101 } 88 102 }
Note:
See TracChangeset
for help on using the changeset viewer.