diff --git a/TODO.html b/TODO.html new file mode 100644 index 00000000..c77f31e6 --- /dev/null +++ b/TODO.html @@ -0,0 +1,149 @@ + + + + + + + TestDrive JSUI Document + + + + + + + + + + + + + + +
+

Todofile

This is a "to do next" file, particularly useful to keep the human and a coding assistant in sync.

The format is based on [Keep a Todofile V0.0.1](https://coulomb.social/open/KeepaTodofile).

The structure organizes **future tasks** by their impact, just as a changelog organizes past changes by their impact.

***

[Unreleased] - *Active Vibe-Coding State* 💡

This section is for tasks currently being discussed with or worked on by the coding assistant. These are the ephemeral, flow-of-thought tasks.

*No active tasks at this time.*

***

Completed Tasks

*Recent completed tasks have been documented in CHANGELOG.md following Keep a Changelog format.* +

+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/capabilities/testdrive-jsui/js/controls/edit-control.js b/capabilities/testdrive-jsui/js/controls/edit-control.js index 7a20a7d2..c42c9109 100644 --- a/capabilities/testdrive-jsui/js/controls/edit-control.js +++ b/capabilities/testdrive-jsui/js/controls/edit-control.js @@ -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 + + @@ -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 */ diff --git a/cost_notes/25114-botched_refactoring_recovery.md b/cost_notes/25114-botched_refactoring_recovery.md new file mode 100644 index 00000000..6528f69c --- /dev/null +++ b/cost_notes/25114-botched_refactoring_recovery.md @@ -0,0 +1,7 @@ +Total cost: $18.34 +Total duration (API): 49m 10.0s +Total duration (wall): 10h 38m 0.7s +Total code changes: 6105 lines added, 186 lines removed +Usage by model: + claude-3-5-haiku: 58.3k input, 7.3k output, 0 cache read, 0 cache write ($0.0760) + claude-sonnet: 9.1k input, 141.0k output, 31.7m cache read, 1.8m cache write ($18.27) diff --git a/markitect/static/js/controls/edit-control.js b/markitect/static/js/controls/edit-control.js index 7a20a7d2..c42c9109 100644 --- a/markitect/static/js/controls/edit-control.js +++ b/markitect/static/js/controls/edit-control.js @@ -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 + + @@ -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 */ diff --git a/testdrive-jsui/static/js/controls/edit-control.js b/testdrive-jsui/static/js/controls/edit-control.js index 7a20a7d2..c42c9109 100644 --- a/testdrive-jsui/static/js/controls/edit-control.js +++ b/testdrive-jsui/static/js/controls/edit-control.js @@ -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 + + @@ -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 */