feat: editor improvements and architectural grid prototype
Multiple feature additions and improvements across the application: - NextGen Editor: drag handles, smart paste, block actions - Structured views: Kanban and table layouts for notes - Architectural Grid: new brainstorming/agent interface prototype - Flashcards: SM-2 revision algorithm with AI generation - MCP server: robustness improvements - Graph/PDF chat: fix click propagation and copy behavior - Various UI/UX enhancements and bug fixes Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,25 @@ import type { Note } from '@/lib/types'
|
||||
const MD_IMG = /!\[[^\]]*\]\(([^)\s]+)\)/g
|
||||
const HTML_IMG = /<img[^>]+src=["']([^"']+)["'][^>]*>/gi
|
||||
|
||||
/** SSR-safe HTML entity decode so excerpt text matches server and client. */
|
||||
function decodeHtmlEntities(text: string): string {
|
||||
return text
|
||||
.replace(/ /gi, ' ')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/(?:�*39;|')/g, "'")
|
||||
.replace(/&#(\d+);/g, (_, code: string) => {
|
||||
const n = Number(code)
|
||||
return n > 0 && n < 0x110000 ? String.fromCodePoint(n) : `&#${code};`
|
||||
})
|
||||
.replace(/&#x([0-9a-f]+);/gi, (_, hex: string) => {
|
||||
const n = parseInt(hex, 16)
|
||||
return n > 0 && n < 0x110000 ? String.fromCodePoint(n) : `&#x${hex};`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Plain-text preview for list view (light markdown stripping).
|
||||
*/
|
||||
@@ -58,6 +77,7 @@ export function getNotePlainExcerpt(note: Note, maxLen = 240): string {
|
||||
let raw = note.content || ''
|
||||
raw = raw.replace(/!\[[^\]]*\]\([^)]+\)/g, ' ')
|
||||
raw = raw.replace(/<[^>]+>/g, ' ')
|
||||
raw = decodeHtmlEntities(raw)
|
||||
return stripMarkdownPreview(raw, maxLen)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user