feat: remove legacy DocumentControls component
Some checks failed
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled

Remove deprecated DocumentControls from TestDrive JSUI plugin system:
- Remove document-controls.js from plugin asset list
- Remove script reference from HTML template
- Delete legacy document-controls files
- Consolidate all functionality into enhanced control panels

All control panel functionality now provided by enhanced controls:
- ContentsControl (NW): Table of contents and navigation
- StatusControl (E): Document status and metrics
- DebugControl (SE): Debug messages and system info
- EditControl (NE): Editing tools including Reset All button

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-14 15:46:50 +01:00
parent ca431ac11f
commit 95ea13958a
6 changed files with 14 additions and 641 deletions

View File

@@ -75,12 +75,7 @@ const MarkitectMain = {
console.log('✅ DebugPanel initialized');
}
// Initialize document controls
if (typeof DocumentControls !== 'undefined') {
this.documentControls = new DocumentControls();
this.documentControls.create();
console.log('✅ DocumentControls initialized');
}
// Legacy DocumentControls removed - functionality now in enhanced control panels
},
// Initialize enhanced control panels with compass positioning
@@ -124,73 +119,11 @@ const MarkitectMain = {
}
},
// Setup event handlers
// Setup core event handlers (enhanced control panels handle their own events)
setupEventHandlers: function() {
console.log('🔌 Setting up event handlers...');
console.log('🔌 Setting up core event handlers...');
if (!this.documentControls) return;
this.documentControls.setEventHandlers({
'save-document': () => {
console.log('💾 Save document clicked');
try {
const currentMarkdown = this.sectionManager.getDocumentMarkdown();
const now = new Date();
const timestamp = now.toISOString().slice(0, 19).replace(/:/g, '-').replace('T', '-');
const filename = `${this.config.originalFilename}-edited-${timestamp}.md`;
const blob = new Blob([currentMarkdown], { type: 'text/markdown' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
if (this.debugPanel) {
this.debugPanel.addMessage(`Document saved as: ${filename}`, 'SUCCESS');
}
console.log(`✅ Document saved as: ${filename}`);
} catch (error) {
if (this.debugPanel) {
this.debugPanel.addMessage(`Save failed: ${error.message}`, 'ERROR');
}
console.error('❌ Save error:', error);
}
},
'reset-all': () => {
console.log('🔄 Reset all clicked');
try {
this.domRenderer.hideCurrentEditor();
const allSections = Array.from(this.sectionManager.sections.values());
allSections.forEach(section => section.resetToOriginal());
this.domRenderer.renderAllSections(allSections);
if (this.debugPanel) {
this.debugPanel.addMessage('Reset all sections to original state', 'INFO');
}
} catch (error) {
console.error('❌ Reset all failed:', error);
}
},
'show-status': () => {
const status = this.sectionManager.getDocumentStatus();
alert(`Document Status:\nTotal Sections: ${status.totalSections}\nEditing Sections: ${status.editingSections}`);
},
'toggle-debug': () => {
if (this.debugPanel) {
this.debugPanel.toggle();
}
}
});
// Setup section manager event handlers
// Setup section manager event handlers for debug panel
if (this.sectionManager && this.debugPanel) {
this.sectionManager.on('sections-created', (data) => {
this.debugPanel.addMessage(`Created ${data.count} sections`, 'INFO');
@@ -209,6 +142,13 @@ const MarkitectMain = {
this.debugPanel.addMessage(`Changes cancelled for section: ${data.sectionId}`, 'WARNING');
});
}
// Make core components available globally for enhanced controls
window.sectionManager = this.sectionManager;
window.domRenderer = this.domRenderer;
window.debugPanel = this.debugPanel;
console.log('✅ Core event handlers and global references set up');
},
// Render content using the configuration