Transcribe voice in webpages
This commit is contained in:
parent
b6505aa07d
commit
18737324e6
|
@ -188,7 +188,7 @@ async function wrapVoiceMessage(audioEl: AudioElement) {
|
|||
speechRecognitionDiv.append(speechRecognitionIcon);
|
||||
|
||||
speechRecognitionDiv.onclick = () => {
|
||||
const speechTextDiv = audioEl.parentElement.querySelector<HTMLElement>('.audio-transcribed-text');
|
||||
const speechTextDiv = (findUpClassName(audioEl, 'document-wrapper') || findUpClassName(audioEl, 'quote-text')).querySelector<HTMLElement>('.audio-transcribed-text');
|
||||
if(audioEl.transcriptionState === 0) {
|
||||
if(speechTextDiv) {
|
||||
speechTextDiv.classList.remove('hide');
|
||||
|
|
|
@ -635,7 +635,7 @@ export default class ChatBubbles {
|
|||
// const scrollSaver = this.createScrollSaver(false);
|
||||
// scrollSaver.save();
|
||||
|
||||
const speechTextDiv = bubble.querySelector('.document-wrapper') as HTMLElement;
|
||||
const speechTextDiv = bubble.querySelector('.document-wrapper, .quote-text.has-document') as HTMLElement;
|
||||
const speechRecognitionIcon = audioElement.querySelector('.audio-to-text-button span');
|
||||
const speechRecognitionLoader = audioElement.querySelector('.loader');
|
||||
if(speechTextDiv && speechRecognitionIcon) {
|
||||
|
@ -644,7 +644,12 @@ export default class ChatBubbles {
|
|||
transcribedText = document.createElement('div');
|
||||
transcribedText.classList.add('audio-transcribed-text');
|
||||
transcribedText.append(document.createTextNode(''));
|
||||
audioElement.before(transcribedText);
|
||||
|
||||
if(speechTextDiv.classList.contains('document-wrapper')) {
|
||||
audioElement.before(transcribedText);
|
||||
} else {
|
||||
speechTextDiv.append(transcribedText);
|
||||
}
|
||||
|
||||
if(pending) {
|
||||
const dots = document.createElement('span');
|
||||
|
|
|
@ -2436,6 +2436,11 @@ $bubble-border-radius-big: 12px;
|
|||
}
|
||||
}
|
||||
|
||||
.web .audio-transcribed-text {
|
||||
margin-bottom: 0;
|
||||
order: 4;
|
||||
}
|
||||
|
||||
.audio-transcribed-text {
|
||||
margin-bottom: .75rem;
|
||||
margin-top: .25rem;
|
||||
|
|
Loading…
Reference in New Issue