- Timestamp:
- 2021-10-15T10:50:08+13:00 (3 years ago)
- Location:
- main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/TranscriptionItemEditor.vue
r35602 r35603 12 12 <ul class="list-view" v-else> 13 13 <li v-for="(word, index) in words" :key="word.id" class="word-container"> 14 <!-- :size="word.word.length === 0 ? 1 : word.word.length" --> 15 <input :ref="word.id" 14 <input :size="word.word.length === 0 ? 1 : word.word.length" :ref="word.id" 16 15 class="editor-word" v-model="word.word" type="text" :class="{ 'word-highlight-applied': word.shouldHighlight }" 17 16 @beforeinput="onEditorBeforeInput($event, index)" @focusout="onEditorFocusOut(index)" @focus="onEditorFocus(index)" /> … … 21 20 </div> 22 21 23 <word-timing-selector class="word-timing-selector" v-model:surroundingWords="surroundingWords" :wordIndex="surroundingWordPrincipleIndex" v-if="enableEditing" />22 <word-timing-selector class="word-timing-selector" :surroundingWords="surroundingWords" :wordIndex="surroundingWordPrincipleIndex" @wordUpdated="onWordUpdated" v-if="enableEditing" /> 24 23 </div> 25 24 </template> … … 128 127 } 129 128 }, 130 surroundingWords: { 131 get() { 132 return this.getSurroundingWords(this.selectedIndex); 133 }, 134 set(value) { 135 this.setSurroundingWords(this.selectedIndex, value); 136 } 129 surroundingWords() { 130 return this.getSurroundingWords(this.selectedIndex); 137 131 }, 138 132 ...mapState({ … … 208 202 209 203 getSurroundingWords(index) { 210 const BUFFER = 2; // The number of words to take on each side 204 const BUFFER = 2; // The number of words to take on each side TODO: Global constant 211 205 212 206 const min = this.getSurroundingWordMinIndex(index, BUFFER); … … 221 215 }, 222 216 223 /** 224 * Sets the backing value of the surrounding words variable. 225 * @param {Number} index The index in the back array at which to update the words. 226 * @param {Array<Word>} value The updated words. 227 */ 228 setSurroundingWords(index, value) { 229 const BUFFER = 2; // The number of words to take on each side TODO: Global constant 230 231 const startIndex = this.getSurroundingWordMinIndex(index, BUFFER); 232 console.log(this.words); 233 this.words.splice(startIndex, value.length - 1, value); 234 console.log(this.words); 217 onWordUpdated(relativeIndex, word) { 218 const BUFFER = 2; // The number of words to take on each side 219 220 const min = this.getSurroundingWordMinIndex(this.selectedIndex, BUFFER); 221 222 this.words[min + relativeIndex] = word; 235 223 }, 236 224 -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/WordTimingSelector.vue
r35602 r35603 123 123 } 124 124 }, 125 emits: [ " update:surroundingWords" ],125 emits: [ "wordUpdated" ], 126 126 computed: { 127 127 word() { … … 338 338 }, 339 339 updateSurroundingWords() { 340 const updatedWords = [];341 342 340 for (let i = 0; i < this.mySurroundingWords.length; i++) { 343 updatedWords.push( 344 this.convertMyWord(this.mySurroundingWords[i], this.surroundingWords[i]) 345 ); 346 } 347 348 console.log(updatedWords); 349 this.$emit("update:surroundingWords", updatedWords); 341 const updatedWord = this.convertMyWord(this.mySurroundingWords[i], this.surroundingWords[i]); 342 this.$emit("wordUpdated", i, updatedWord); 343 } 350 344 }, 351 345 convertMyWord(myWord, actualWord) {
Note:
See TracChangeset
for help on using the changeset viewer.