Files
markitect-main/markitect/static/js/controls/debug-control.js
tegwick 5b13c00d3e feat: deploy enhanced ControlBase to MarkiTect md-render --edit
Successfully integrate improved TestDrive-JSUI controls with main MarkiTect system:

## Enhanced Control System
- Updated ControlBase with 5 advanced behaviors from reference implementation
- All controls now support icon-only collapsed state, drag/resize, position restoration
- Seamless integration with md-render --edit command

## Updated Components
- DebugControl: Enhanced with new ControlBase inheritance
- EditControl: Full document editing tools with export/formatting
- StatusControl: Real-time document statistics and metrics
- ContentsControl: Interactive table of contents navigation

## Deployment Integration
- All enhanced controls deployed via asset system
- Compatible with existing edit mode functionality
- Maintains backward compatibility with legacy systems

## Verification
- Successfully renders interactive HTML with md-render --edit
- All control behaviors working in production environment
- Asset deployment system properly handles enhanced controls

The enhanced control system is now live and functional in MarkiTect's editing environment.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-14 11:35:47 +01:00

52 lines
2.3 KiB
JavaScript

/**
* Debug Control - Displays debug information and system messages
* Implements the Robustness Principle with Fail Fast mode support
*/
class DebugControl extends ControlBase {
constructor() {
super();
this.config = {
icon: '🪲',
title: 'Debug',
className: 'debug-control',
defaultContent: 'Click to view debug information',
ariaLabel: 'Debug Control',
position: 'w'
};
// Store messages for debug display
this.messages = [];
}
buildContent() {
const content = this.element?.querySelector('.control-content');
if (content) {
const messages = window.MarkitectDebugSystem ?
window.MarkitectDebugSystem.getMessages() : [];
content.innerHTML = `
<div style="padding: 1rem; font-size: 0.8rem;">
<h4 style="margin-top: 0;">Debug Messages</h4>
<div style="max-height: 200px; overflow-y: auto;">
${messages.length > 0 ?
messages.slice(-10).map(msg =>
`<div style="margin-bottom: 0.5rem; padding: 0.3rem; background: #f8f9fa; border-radius: 3px;">
<strong>[${msg.category}]</strong> ${msg.component}: ${msg.message}
<div style="font-size: 0.7rem; color: #666;">${msg.displayTime}</div>
</div>`
).join('') :
'<p>No debug messages yet</p>'
}
</div>
<button onclick="if(window.MarkitectDebugSystem) window.MarkitectDebugSystem.clearMessages(); this.closest('.control-panel').querySelector('.control-content').innerHTML = '<div style=&quot;padding: 1rem; font-size: 0.8rem;&quot;><h4 style=&quot;margin-top: 0;&quot;>Debug Messages</h4><p>Messages cleared</p></div>'"
style="margin-top: 0.5rem; padding: 0.3rem 0.6rem; font-size: 0.7rem; background: #dc3545; color: white; border: none; border-radius: 3px; cursor: pointer;">
Clear Messages
</button>
</div>
`;
}
}
}
window.DebugControl = DebugControl;