Changeset 35383
- Timestamp:
- 2021-09-14T10:55:28+12:00 (3 years ago)
- Location:
- main/trunk/model-interfaces-dev/atea/korero-maori-asr
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-interfaces-dev/atea/korero-maori-asr/package-lock.json
r35356 r35383 11938 11938 } 11939 11939 }, 11940 "vue-contenteditable": {11941 "version": "3.0.4",11942 "resolved": "https://registry.npmjs.org/vue-contenteditable/-/vue-contenteditable-3.0.4.tgz",11943 "integrity": "sha512-CmtqT4zHQwLoJEyNVaXUjjUFPUVYlXXBHfSbRCHCUjODMqrn6L293LM1nc1ELx8epitZZvecTfIqOLlSzB3d+w=="11944 },11945 11940 "vue-eslint-parser": { 11946 11941 "version": "7.10.0", -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/package.json
r35355 r35383 11 11 "core-js": "^3.16.4", 12 12 "vue": "^3.0.0", 13 "vue-contenteditable": "^3.0.4",14 13 "vuex": "^4.0.2" 15 14 }, -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/TranscriptionItemEditor.vue
r35382 r35383 31 31 <ul class="list-view" v-if="displayMode == 'editor'"> 32 32 <li v-for="(word, index) in words" :key="word.id" class="word-container"> 33 <contenteditable class="editor-word" tag="span" v-model="word.word" :noNL="true" :noHTML="true" @input="onEditorInput($event, index)" /> 33 <input :size="word.word.length <= 1 ? 1 : word.word.length - 1" :ref="word.id" 34 class="editor-word" v-model="word.word" type="text" 35 @input="onEditorInput($event, index)" @focusout="onEditorFocusOut(index)" /> 34 36 <span> </span> 35 37 </li> 36 38 </ul> 37 <!-- <ul class="list-view" v-if="displayMode == 'editor'">38 <li v-for="(word, index) in transcription.words" class="transcription__word-container">39 <span class="transcription__word" v-on:input="onEditorWordInput($event, word.word)" contenteditable="true" v-text="word.word" />40 <input type="text" v-bind:size="word.word.length == 1 ? 1 : word.word.length - 1" v-model="word.word"41 class="transcription__word" v-on:input="onEditorWordInput($event, index, id)" />42 <span> </span>43 </li>44 </ul> -->45 39 </div> 46 40 </template> … … 72 66 .editor-word { 73 67 border: 1px solid black; 68 border-radius: 2px; 74 69 padding: 2px; 75 min-width: 5px; 70 font-family: inherit; 71 font-size: 1rem; 76 72 } 77 73 </style> … … 79 75 <script> 80 76 import { mapState } from "vuex"; 81 import contenteditable from "vue-contenteditable"82 77 import { TranscriptionViewModel } from "../main"; 83 78 import Util from "../js/Util"; … … 111 106 export default { 112 107 name: "TranscriptionItemEditor", 113 components: {114 contenteditable115 },116 108 props: { 117 109 transcription: TranscriptionViewModel … … 140 132 */ 141 133 onEditorInput(event, index) { 134 console.log(event); 135 142 136 /** @type {Word} */ 143 137 const word = this.words[index]; 138 144 139 if (event.inputType === "insertText") { 145 140 if (event.data === " ") { 146 141 word.word = word.word.replace(" ", ""); 147 // TODO: Proper timing 148 this.words.splice(index + 1, 0, new Word("", word.startTime, word.endTime)); 142 143 // TODO: Proper timing metadata 144 const newWord = new Word("", word.startTime, word.endTime); 145 this.words.splice(index + 1, 0, newWord); 146 147 // We have to give the element some time to render, even though the ref is registered immediately 148 setTimeout(() => this.$refs[newWord.id].focus(), 50); 149 149 } 150 150 } 151 console.log(index); 151 }, 152 onEditorFocusOut(index) { 153 if (this.words[index].word === "") { 154 this.words.splice(index, 1); 155 } 152 156 } 153 157 }, … … 192 196 for (const metadata of transcription.metadata) { 193 197 if (metadata.char === " ") { 194 words.push( { word: lastWord, startTime: currStartTime, endTime: metadata.start_time, shouldHighlight: false });198 words.push(new Word(lastWord, currStartTime, metadata.start_time)); 195 199 196 200 lastWord = ""; … … 204 208 // Push the last word, as most transcriptions will not end in a space (hence breaking the above algorithm) 205 209 if (lastWord.length > 0) { 206 words.push(new Word(lastWord, currStartTime, transcription.metadata[transcription.metadata.length - 1].start_time)); 210 const newWord = new Word(lastWord, currStartTime, transcription.metadata[transcription.metadata.length - 1].start_time) 211 words.push(newWord); 207 212 } 208 213 -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/styles/_material.scss
r35355 r35383 10 10 :root { 11 11 --primary-bg-color-l1: #249ccf; 12 --primary-bg-color: #2191c0; 13 --primary-bg-color-d1: #2785ad; 14 --primary-bg-color-d2: #227497; 12 --primary-bg-color: #21c05e; // #21c05e 15 13 16 14 --primary-fg-color: white; -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/styles/theme.scss
r35355 r35383 6 6 @import url('https://fonts.googleapis.com/css2?family=Roboto+Mono&family=Roboto:wght@400;700&display=swap'); 7 7 @import url('https://fonts.googleapis.com/icon?family=Material+Icons'); 8 9 *, 10 *::before, 11 *::after { 12 box-sizing: border-box; 13 } 8 14 9 15 :root {
Note:
See TracChangeset
for help on using the changeset viewer.