mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 04:39:31 +08:00
Add rich text and learning blocks, media uploads, page trees, and revisioned notebook storage. Present AI suggestions at their target blocks with durable accept and dismiss actions. Unify saved outputs as Favorites with typed expandable blocks, stable source links, atomic batch insertion, nesting, dragging, and undo/redo. Validation: 99 frontend tests and 99 backend tests pass in an isolated snapshot, along with TypeScript, scoped ESLint, dependency architecture, and locale parity checks.
24 lines
842 B
TypeScript
24 lines
842 B
TypeScript
'use client'
|
|
|
|
import { defaultBlockSpecs } from '@blocknote/core'
|
|
import { createReactBlockSpec } from '@blocknote/react'
|
|
import { FileText, ArrowUpRight } from 'lucide-react'
|
|
import { apiUrl } from '@/lib/api'
|
|
import { safeNoteUrl } from '../model/urls'
|
|
|
|
export const noteFile = createReactBlockSpec(defaultBlockSpecs.file.config, {
|
|
render: ({ block }) => {
|
|
const url = safeNoteUrl(block.props.url)
|
|
return (
|
|
<div className="dt-note-file" contentEditable={false}>
|
|
<a href={url ? apiUrl(url) : undefined} target="_blank" rel="noopener noreferrer">
|
|
<FileText size={20} aria-hidden="true" />
|
|
<span>{block.props.name || block.props.url}</span>
|
|
<ArrowUpRight size={16} aria-hidden="true" />
|
|
</a>
|
|
{block.props.caption && <p>{block.props.caption}</p>}
|
|
</div>
|
|
)
|
|
},
|
|
})
|