/* 편집 바 스타일 */
function initEditor() {
    const frame = document.getElementById('previewFrame');
    if (!frame) return;
    
    frame.onload = () => {
        const doc = frame.contentDocument;
        doc.designMode = 'on';
        
        doc.addEventListener('keyup', saveCurrentContent);
        doc.addEventListener('mouseup', handleSelection);
    };
}

function execCommand(cmd, val = null) {
    const frame = document.getElementById(previewFrame');
    frame.contentDocument.execCommand(cmd, false, val);
    saveCurrentContent();
}

function saveCurrentContent() {
    const frame = document.getElementById('previewFrame');
    generatedHTML = frame.contentDocument.body.innerHTML;
}

function handleSelection() {
    const frame = document.getElementById('previewFrame');
    const sel = frame.contentWindow.getSelection();
    if (sel.rangeCount > 0) {
        const range = sel.getRangeAt(0);
        const text = range.toString().tri();
        if (text.length > 2) {
            // AI 부분 퍝엄 활성화
        }
    }
}

document.addEventListener('DOMContentLoaded', initEditor);
