Online Smart Note-Taking App

Online Smart Note-Taking App

Your Smart Notebook

Select a note to edit or create a new one to get started.

Please write more content (at least 50 characters) to generate a summary.

'; summaryModal.classList.remove('hidden'); return; } summaryModal.classList.remove('hidden'); summaryContent.innerHTML = '
'; try { const summary = await callGeminiAPI(content); summaryContent.innerHTML = `

${summary}

`; } catch (error) { console.error("Summarization failed:", error); summaryContent.innerHTML = '

Failed to generate summary. Please try again later.

'; } }); closeModalBtn.addEventListener('click', () => summaryModal.classList.add('hidden')); async function callGeminiAPI(text) { const apiKey = ""; // API key handled by environment const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-05-20:generateContent?key=${apiKey}`; const prompt = `Summarize the following note into a few key bullet points:\n\n---\n${text}\n---`; const payload = { contents: [{ parts: [{ text: prompt }] }] }; const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); if (!response.ok) throw new Error(`API request failed with status ${response.status}`); const result = await response.json(); return result.candidates[0].content.parts[0].text; } // --- PDF DOWNLOAD LOGIC --- downloadPdfBtn.addEventListener('click', () => { if (!currentNoteId) return; const note = notes.find(n => n.id === currentNoteId); const { jsPDF } = window.jspdf; const tempDiv = document.createElement('div'); tempDiv.innerHTML = `

${note.title}

${note.content}

`; document.body.appendChild(tempDiv); html2canvas(document.getElementById('pdf-content'), { scale: 2 }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const canvasWidth = canvas.width; const canvasHeight = canvas.height; const ratio = canvasWidth / canvasHeight; const widthInPdf = pdfWidth - 80; const heightInPdf = widthInPdf / ratio; pdf.addImage(imgData, 'PNG', 40, 40, widthInPdf, heightInPdf); pdf.save(`${note.title.replace(/\s/g, '-') || 'note'}.pdf`); document.body.removeChild(tempDiv); }); }); // --- INITIALIZATION --- renderNoteList(); displayEditor(false); lucide.createIcons(); });
Scroll to Top