feat: bloc Toggle/Section repliable + infrastructure embeddings par fragments
Some checks failed
CI / Lint, Unit Tests & Build (push) Failing after 1m33s
CI / Deploy production (on server) (push) Has been skipped

- Nouveau bloc Toggle : sections dépliables dans l'éditeur (slash menu + drag handle)
  - Transformer un bloc existant en section repliable via le menu d'action
  - Boutons désactiver (unwrap) et supprimer dans l'en-tête
  - i18n FR/EN complet
- Infrastructure embeddings par fragments (inspiré AppFlowy)
  - Table NoteEmbeddingChunk + index HNSW
  - Chunking sémantique (~1000 chars, overlap 200, dedup par hash)
  - Indexation incrémentale au save (createNote + updateNote + clip)
  - Queue concurrence 4, retry backoff exponentiel
This commit is contained in:
Antigravity
2026-06-14 16:23:56 +00:00
parent a623454347
commit fccad72d47
7 changed files with 219 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ import { ChartSuggestionsDialog } from './chart-suggestions-dialog'
import { UniqueIdExtension } from './tiptap-unique-id-extension'
import { LiveBlockExtension } from './tiptap-live-block-extension'
import { StructuredViewBlockExtension, insertStructuredViewBlockAtSelection } from './tiptap-structured-view-block-extension'
import { ToggleExtension, insertToggleBlock } from './tiptap-toggle-extension'
import { RtlPreserveExtension } from './tiptap-rtl-preserve-extension'
import { ClipArticleExtension } from './tiptap-clip-article-extension'
import { BlockPicker, type BlockSuggestion } from './block-picker'
@@ -61,7 +62,8 @@ import {
Sparkles, Wand2, Scissors, Lightbulb, X, Check, ExternalLink,
FileText, Pilcrow, MessageSquare, AlignLeft, AlignCenter, AlignRight,
Superscript as SuperscriptIcon, Subscript as SubscriptIcon, Expand, Plus,
SpellCheck, Languages, BookOpen, Presentation, BarChart3, Database
SpellCheck, Languages, BookOpen, Presentation, BarChart3, Database,
ChevronsRightLeft
} from 'lucide-react'
import { cn } from '@/lib/utils'
import { toast } from 'sonner'
@@ -202,6 +204,10 @@ const slashCommands: SlashItem[] = [
title: 'Database', description: 'Inline database', icon: Database, category: 'Basic blocks', shortcut: '/database',
command: (e) => { insertStructuredViewBlockAtSelection(e) },
},
{
title: 'Toggle', description: 'Collapsible section', icon: ChevronsRightLeft, category: 'Basic blocks', shortcut: '>',
command: (e) => { insertToggleBlock(e) },
},
]
async function aiReformulate(text: string, option: string, t: any, language?: string): Promise<string> {
@@ -423,6 +429,7 @@ export const RichTextEditor = forwardRef<RichTextEditorHandle, RichTextEditorPro
UndoRedoFeedbackExtension,
LiveBlockExtension,
StructuredViewBlockExtension,
ToggleExtension,
ClipArticleExtension,
RtlPreserveExtension,
Placeholder.configure({
@@ -1592,6 +1599,7 @@ function SlashCommandMenu({ editor, onInsertImage, onSuggestCharts }: { editor:
{ ...slashCommands[28], title: 'Suggest Charts', description: 'AI suggère des graphiques basés sur votre contenu', categoryId: 'ai' },
{ ...slashCommands[29], title: 'Living Block', description: 'Insérer un bloc vivant depuis une autre note', categoryId: 'embed' },
{ ...slashCommands[30], title: t('richTextEditor.slashDatabase'), description: t('richTextEditor.slashDatabaseDesc'), categoryId: 'data', slashKeywords: ['database', 'db', 'base', 'données', 'donnees', 'vue', 'tableau', 'structured', 'structuree', 'structurée'] },
{ ...slashCommands[31], title: t('richTextEditor.slashToggle'), description: t('richTextEditor.slashToggleDesc'), categoryId: 'text', slashKeywords: ['toggle', 'accordion', 'replier', 'deroulant', 'déroulant', 'section'] },
{
title: t('richTextEditor.slashNoteLink'),
description: t('richTextEditor.slashNoteLinkDesc'),