fix: agent notes default to markdown, add convert-to-rich-text option
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 45s

- Agent-created notes are now type 'markdown' by default (raw markdown content)
- Switching note type from markdown → richtext auto-converts content to HTML
  via /api/ai/convert-markdown endpoint using the existing markdownToHtml utility
- Users can freely switch between markdown and richtext in the note type selector

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Sepehr Ramezani
2026-05-01 16:32:49 +02:00
parent dbd49d6fcb
commit fcb5932d33
4 changed files with 55 additions and 9 deletions

View File

@@ -495,10 +495,36 @@ export function NoteInlineEditor({
<NoteTypeSelector
value={noteType}
onChange={(newType) => {
onChange={async (newType) => {
const oldType = noteType
setNoteType(newType)
if (newType === 'markdown') setShowMarkdownPreview(true)
else setShowMarkdownPreview(false)
// When switching from markdown to richtext, convert content to HTML
if (oldType === 'markdown' && newType === 'richtext') {
try {
const res = await fetch('/api/ai/convert-markdown', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ content }),
})
if (res.ok) {
const { html } = await res.json()
setContent(html)
saveInline(note.id, {
type: 'richtext',
isMarkdown: false,
content: html,
}).catch(() => {})
onChange?.(note.id, { type: 'richtext', isMarkdown: false, content: html })
return
}
} catch {
// Fall through to save without conversion
}
}
// Persist both type and isMarkdown immediately
saveInline(note.id, {
type: newType,