Content Studio Pro

StudioPro

Words: 0
Session restored


'; break; case 'meta': html = '
Meta Description: Enter description here for SEO...


'; break; case 'h2': html = '

Section Heading


'; break; case 'faq': html = '

Q: What is the main benefit?

A: Explain the answer here...


'; break; case 'cta': html = '

Ready to grow?

Get Started Now


'; break; } editor.focus(); document.execCommand('insertHTML', false, html); } function promptMedia(type) { const url = prompt(`Enter ${type === 'image' ? 'Image URL' : 'YouTube Video URL'}:`); if (!url) return; const editor = document.getElementById(`editor-${state.currentTab}`); let html = ''; if (type === 'image') { html = `


`; } else { const vidId = extractYoutubeId(url); if (vidId) { html = `


`; } else { alert('Invalid YouTube URL'); return; } } editor.focus(); document.execCommand('insertHTML', false, html); } function extractYoutubeId(url) { const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/; const match = url.match(regExp); return (match && match[2].length === 11) ? match[2] : null; } function updateWordCount() { const text = document.getElementById(`editor-${state.currentTab}`).innerText || ''; const count = text.trim() ? text.trim().split(/\s+/).length : 0; document.getElementById('word-count').innerText = `Words: ${count}`; } function saveSession() { state.content[state.currentTab] = document.getElementById(`editor-${state.currentTab}`).innerHTML; localStorage.setItem('studio_content_v1', JSON.stringify(state)); const indicator = document.getElementById('save-indicator'); indicator.style.opacity = '1'; setTimeout(() => indicator.style.opacity = '0', 1000); const now = new Date(); document.getElementById('last-saved').innerText = `Saved at ${now.getHours()}:${now.getMinutes().toString().padStart(2, '0')}`; } function resetCurrentTab() { if (confirm('Are you sure you want to clear this tab?')) { const editor = document.getElementById(`editor-${state.currentTab}`); editor.innerHTML = ''; state.content[state.currentTab] = ''; updateWordCount(); } } function toggleFullscreen() { const root = document.getElementById('studio-root'); root.classList.toggle('fullscreen'); } function exportData(formatType) { const content = document.getElementById(`editor-${state.currentTab}`).innerHTML; const text = document.getElementById(`editor-${state.currentTab}`).innerText; if (formatType === 'copy') { const temp = document.createElement('textarea'); temp.value = text; document.body.appendChild(temp); temp.select(); document.execCommand('copy'); document.body.removeChild(temp); alert('Text copied to clipboard!'); } else { const blob = new Blob([formatType === 'html' ? content : text], { type: 'text/plain' }); const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `studio-export-${state.currentTab}.${formatType === 'html' ? 'html' : 'txt'}`; a.click(); window.URL.revokeObjectURL(url); } } init();