Smart Text Formatter & Data Organizer Pro `;
filename += 'html'; mime = 'text/html';
} else if (type === 'md') {
content = editor.innerText;
filename += 'md'; mime = 'text/markdown';
} else if (type === 'json') {
content = JSON.stringify({ content: editor.innerHTML }, null, 2);
filename += 'json'; mime = 'application/json';
} else {
content = editor.innerText;
filename += 'txt'; mime = 'text/plain';
}
let blob = new Blob([content], { type: mime });
let url = URL.createObjectURL(blob);
let a = document.createElement('a');
a.href = url;
a.download = filename;
a.click();
URL.revokeObjectURL(url);
notify('Exported successfully');
}function populateCommandPalette() {
let list = document.getElementById('stfCommandList');
let cmds = [
{ name: 'Smart Format', fn: smartAutoFormat },
{ name: 'Clean Spaces', fn: cleanSpaces },
{ name: 'Detect Tables', fn: detectTables },
{ name: 'Generate Summary', fn: generateSummary }
];
list.innerHTML = '';
cmds.forEach(c => {
let div = document.createElement('div');
div.style.padding = '8px';
div.style.cursor = 'pointer';
div.textContent = c.name;
div.addEventListener('click', () => {
c.fn();
document.getElementById('stfModalPalette').classList.remove('open');
});
list.appendChild(div);
});
}init();
})();