import { BaseBlockHandler, type IBlockEventHandlers } from '../block.base.js';
import type { IBlock } from '../../wysiwyg.types.js';
import { cssManager } from '@design.estate/dees-element';
/**
 * HTMLBlockHandler - Handles raw HTML content with preview/edit toggle
 * 
 * Features:
 * - Live HTML preview (sandboxed)
 * - Edit/preview mode toggle
 * - Syntax highlighting in edit mode
 * - HTML validation hints
 * - Auto-save on mode switch
 */
export class HtmlBlockHandler extends BaseBlockHandler {
  type = 'html';
  
  render(block: IBlock, isSelected: boolean): string {
    const isEditMode = block.metadata?.isEditMode ?? true;
    const content = block.content || '';
    
    return `
      
        
        
          ${isEditMode ? this.renderEditor(content) : this.renderPreview(content)}
        
       
    `;
  }
  
  private renderEditor(content: string): string {
    return `
      
    `;
  }
  
  private renderPreview(content: string): string {
    return `
      
        ${content || '
No content to preview
'}