mirror of
https://github.com/Zippland/Snap-Solver.git
synced 2026-03-02 08:10:23 +08:00
mathpix done
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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>';
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user