Changeset 35521 for main/trunk
- Timestamp:
- 2021-09-29T14:51:57+13:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/TranscriptionItemEditor.vue
r35517 r35521 20 20 </div> 21 21 22 < !-- <word-timing-selector class="word-timing-selector" :surroundingWords="surroundingWords" :word="selectedWord" /> -->22 <word-timing-selector class="word-timing-selector" :surroundingWords="surroundingWords" :word="selectedWord" /> 23 23 24 24 <div class="editor-controls"> … … 87 87 import AudioPlayback from "../js/AudioPlaybackModule" 88 88 import AudioTimeBar from "./AudioTimeBar.vue" 89 //import WordTimingSelector from "./WordTimingSelector.vue"89 import WordTimingSelector from "./WordTimingSelector.vue" 90 90 import Util, { log } from "../js/Util"; 91 91 … … 121 121 name: "TranscriptionItemEditor", 122 122 components: { 123 AudioTimeBar //,124 //WordTimingSelector123 AudioTimeBar, 124 WordTimingSelector 125 125 }, 126 126 props: { … … 215 215 216 216 if (insertionEvents.includes(event.inputType)) { 217 if (event.data === " ") { 218 // Only insert if the current word isn't blank, to prevent 'jumping jacks' as the duplicate empty boxes are removed 219 if (word.word !== "") { 217 const inputIndex = this.$refs[word.id].selectionStart; 218 219 if (event.data === " ") { // ONLY whitespace entered. Split or add new word 220 let newWord; 221 222 if (inputIndex === 0) { 223 const newEndTime = word.startTime + (word.endTime - word.startTime) / 2; 224 newWord = new Word("", word.startTime, newEndTime); 225 226 this.words.splice(index, 0, newWord); 227 word.startTime = newEndTime; 228 } 229 else if (inputIndex === word.word.length) { 220 230 const newStartTime = word.startTime + ((word.endTime - word.startTime) / 2); 221 const newWord = new Word("", newStartTime, word.endTime); 231 newWord = new Word("", newStartTime, word.endTime); 232 222 233 this.words.splice(index + 1, 0, newWord); 223 224 // We have to give the element some time to be mounted before we can focus it 225 setTimeout(() => this.$refs[newWord.id].focus(), 50); 234 word.endTime = newStartTime; 226 235 } 236 else { 237 // Split down middle 238 } 227 239 228 240 event.preventDefault(); 241 setTimeout(() => this.$refs[newWord.id].focus(), 50); // Give the element time to be mounted before focusing 242 } 243 else if (event.data.includes(" ")) { 244 // Split input 229 245 } 230 246 }
Note:
See TracChangeset
for help on using the changeset viewer.