feat: add Reset All button to EditControl panel
Add the missing "Reset All" functionality from Legacy Document Control to the enhanced EditControl panel for complete feature parity. ## New Functionality - Added "Reset All" button in Document Actions section - Comprehensive reset functionality with user confirmation - Resets font size, editing mode, unsaved changes, highlights - Integrates with SectionManager, DocumentControls, and DebugControl - Offers page reload as ultimate fallback for complete reset ## Implementation Details - Button styled consistently with Legacy Document Control (🔄 Reset All) - Uses #ffc107 background with #212529 text to match legacy styling - Comprehensive confirmation dialog explains all actions - Safe operation wrapper with proper error handling - Graceful fallbacks when integrated components are unavailable ## Integration - Deployed to both markitect system and deployment source - Compatible with existing enhanced ControlBase architecture - Maintains consistency with other EditControl actions - Ready for immediate use in production environment Users now have access to the familiar Reset All functionality within the modern enhanced control panel system. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -88,6 +88,11 @@ class EditControl extends ControlBase {
|
||||
style="width: 100%; padding: 0.5rem; margin-bottom: 0.3rem; background: #17a2b8; color: white; border: none; border-radius: 3px; cursor: pointer; font-size: 0.8rem;">
|
||||
📄 Export Document
|
||||
</button>
|
||||
|
||||
<button onclick="this.closest('.edit-control').editControl.resetAll()"
|
||||
style="width: 100%; padding: 0.5rem; margin-bottom: 0.3rem; background: #ffc107; color: #212529; border: none; border-radius: 3px; cursor: pointer; font-size: 0.8rem;">
|
||||
🔄 Reset All
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Navigation Tools -->
|
||||
@@ -296,6 +301,69 @@ class EditControl extends ControlBase {
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all changes and restore document to original state
|
||||
*/
|
||||
resetAll() {
|
||||
return this.safeOperation(() => {
|
||||
// Show confirmation dialog
|
||||
const confirmed = window.confirm(
|
||||
'Reset all changes?\n\nThis will:\n' +
|
||||
'• Restore document to original state\n' +
|
||||
'• Clear all unsaved changes\n' +
|
||||
'• Reset font size and other settings\n\n' +
|
||||
'This action cannot be undone.'
|
||||
);
|
||||
|
||||
if (!confirmed) {
|
||||
this.showActionFeedback('🚫 Reset cancelled', '#6c757d');
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset edit control state
|
||||
this.fontSize = 16;
|
||||
this.editingMode = 'view';
|
||||
this.unsavedChanges = false;
|
||||
this.lastSaveTime = null;
|
||||
|
||||
// Reset font size
|
||||
this.applyFontSize();
|
||||
|
||||
// Clear any highlights
|
||||
document.querySelectorAll('.edit-highlight').forEach(el => {
|
||||
el.outerHTML = el.innerHTML;
|
||||
});
|
||||
|
||||
// Try to reset sections if SectionManager is available
|
||||
if (window.sectionManager && typeof window.sectionManager.resetAllSections === 'function') {
|
||||
window.sectionManager.resetAllSections();
|
||||
}
|
||||
|
||||
// Try to reset document controls if available
|
||||
if (window.documentControls && typeof window.documentControls.resetAllChanges === 'function') {
|
||||
window.documentControls.resetAllChanges();
|
||||
}
|
||||
|
||||
// Clear any debug messages if debug control is available
|
||||
if (window.debugControl && typeof window.debugControl.clearMessages === 'function') {
|
||||
window.debugControl.clearMessages();
|
||||
}
|
||||
|
||||
// Reload the page as ultimate fallback
|
||||
if (window.confirm('Reload page to complete reset?')) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the control display
|
||||
this.buildContent();
|
||||
|
||||
// Show feedback
|
||||
this.showActionFeedback('🔄 All changes reset', '#ffc107', '#212529');
|
||||
|
||||
}, null, 'resetAll');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll to top of document
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user