mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Fix add, remove of the text to speech loader element in Obsidian
This commit is contained in:
@@ -318,7 +318,6 @@ export class KhojChatView extends KhojPaneView {
|
||||
speechIcon = event.target as Element;
|
||||
}
|
||||
|
||||
speechButton.innerHTML = "";
|
||||
speechButton.appendChild(loader);
|
||||
speechButton.disabled = true;
|
||||
|
||||
@@ -339,15 +338,13 @@ export class KhojChatView extends KhojPaneView {
|
||||
source.connect(context.destination);
|
||||
source.start(0);
|
||||
source.onended = function() {
|
||||
speechButton.innerHTML = "";
|
||||
speechButton.appendChild(speechIcon);
|
||||
speechButton.removeChild(loader);
|
||||
speechButton.disabled = false;
|
||||
};
|
||||
})
|
||||
.catch(err => {
|
||||
console.error("Error playing speech:", err);
|
||||
speechButton.innerHTML = "";
|
||||
speechButton.appendChild(speechIcon);
|
||||
speechButton.removeChild(loader);
|
||||
speechButton.disabled = false; // Consider enabling the button again to allow retrying
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user