mathpix done

This commit is contained in:
Zylan
2025-02-04 21:12:14 +08:00
parent 65830eaea3
commit 56bd1785bf
5 changed files with 10 additions and 872 deletions

View File

@@ -73,14 +73,10 @@ window.renderHistory = function() {
// Reset confidence display
document.getElementById('confidenceDisplay').textContent = '';
// Only show text editor if there was extracted text
if (historyItem.extractedText) {
window.app.textEditor.classList.remove('hidden');
window.app.extractedText.value = historyItem.extractedText;
} else {
window.app.textEditor.classList.add('hidden');
window.app.extractedText.value = '';
}
// Always hide text editor and extracted text in history view
window.app.textEditor.classList.add('hidden');
window.app.extractedText.value = '';
window.app.sendExtractedTextBtn.classList.add('hidden');
// Show response if it exists
if (historyItem.response) {

View File

@@ -144,12 +144,15 @@ class SnapSolver {
this.extractedText.value = '';
this.extractedText.disabled = false;
}
this.sendExtractedTextBtn.disabled = false; // Re-enable send button on server error
} else if (data.content) {
if (this.extractedText) {
this.extractedText.value = data.content;
this.extractedText.disabled = false;
// Scroll to make text editor visible
this.extractedText.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
// Enable the Send Text to AI button
this.sendExtractedTextBtn.disabled = false;
}
window.showToast('Text extracted successfully');
}
@@ -413,6 +416,7 @@ class SnapSolver {
}
this.extractTextBtn.disabled = true;
this.sendExtractedTextBtn.disabled = true; // Disable the send button while extracting
this.extractTextBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i><span>Extracting...</span>';
const settings = window.settingsManager.getSettings();
@@ -444,6 +448,7 @@ class SnapSolver {
} catch (error) {
window.showToast('Failed to extract text: ' + error.message, 'error');
this.extractTextBtn.disabled = false;
this.sendExtractedTextBtn.disabled = false; // Re-enable send button on error
this.extractTextBtn.innerHTML = '<i class="fas fa-font"></i><span>Extract Text</span>';
}
});