mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 21:29:11 +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;
|
speechIcon = event.target as Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
speechButton.innerHTML = "";
|
|
||||||
speechButton.appendChild(loader);
|
speechButton.appendChild(loader);
|
||||||
speechButton.disabled = true;
|
speechButton.disabled = true;
|
||||||
|
|
||||||
@@ -339,15 +338,13 @@ export class KhojChatView extends KhojPaneView {
|
|||||||
source.connect(context.destination);
|
source.connect(context.destination);
|
||||||
source.start(0);
|
source.start(0);
|
||||||
source.onended = function() {
|
source.onended = function() {
|
||||||
speechButton.innerHTML = "";
|
speechButton.removeChild(loader);
|
||||||
speechButton.appendChild(speechIcon);
|
|
||||||
speechButton.disabled = false;
|
speechButton.disabled = false;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error("Error playing speech:", err);
|
console.error("Error playing speech:", err);
|
||||||
speechButton.innerHTML = "";
|
speechButton.removeChild(loader);
|
||||||
speechButton.appendChild(speechIcon);
|
|
||||||
speechButton.disabled = false; // Consider enabling the button again to allow retrying
|
speechButton.disabled = false; // Consider enabling the button again to allow retrying
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user