diff --git a/memento-note/components/rich-text-editor.tsx b/memento-note/components/rich-text-editor.tsx index 831ab7d..7639e98 100644 --- a/memento-note/components/rich-text-editor.tsx +++ b/memento-note/components/rich-text-editor.tsx @@ -53,6 +53,7 @@ type SlashItem = { } const slashCommands: SlashItem[] = [ + // Basic blocks (indices 0-9) { title: 'Text', description: 'Plain paragraph', icon: Pilcrow, category: 'Basic blocks', shortcut: '¶', command: (e) => e.chain().focus().setParagraph().run() }, { title: 'Heading 1', description: 'Big section heading', icon: Heading1, category: 'Basic blocks', shortcut: '#', command: (e) => e.chain().focus().toggleHeading({ level: 1 }).run() }, { title: 'Heading 2', description: 'Medium section heading', icon: Heading2, category: 'Basic blocks', shortcut: '##', command: (e) => e.chain().focus().toggleHeading({ level: 2 }).run() }, @@ -63,18 +64,13 @@ const slashCommands: SlashItem[] = [ { title: 'Quote', description: 'Capture a quote', icon: Quote, category: 'Basic blocks', shortcut: '>', command: (e) => e.chain().focus().toggleBlockquote().run() }, { title: 'Code Block', description: 'Code snippet', icon: CodeXml, category: 'Basic blocks', shortcut: '```', command: (e) => e.chain().focus().toggleCodeBlock().run() }, { title: 'Divider', description: 'Horizontal separator', icon: Minus, category: 'Basic blocks', shortcut: '---', command: (e) => e.chain().focus().setHorizontalRule().run() }, + // Media (index 10) { title: 'Image', description: 'Embed image from URL', icon: ImageIcon, category: 'Media', isImage: true, command: () => {} }, + // Formatting (indices 11-13) — super/subscript removed, use BubbleMenu { title: 'Align Left', description: 'Align text left', icon: AlignLeft, category: 'Formatting', command: (e) => e.chain().focus().setTextAlign('left').run() }, { title: 'Align Center', description: 'Center text', icon: AlignCenter, category: 'Formatting', command: (e) => e.chain().focus().setTextAlign('center').run() }, { title: 'Align Right', description: 'Align text right', icon: AlignRight, category: 'Formatting', command: (e) => e.chain().focus().setTextAlign('right').run() }, - { title: 'Superscript', description: 'Sélectionner du texte d’abord', icon: SuperscriptIcon, category: 'Formatting', command: (e) => { - if (!e.state.selection.empty) e.chain().focus().toggleSuperscript().run() - else e.chain().focus().run() - }}, - { title: 'Subscript', description: 'Sélectionner du texte d’abord', icon: SubscriptIcon, category: 'Formatting', command: (e) => { - if (!e.state.selection.empty) e.chain().focus().toggleSubscript().run() - else e.chain().focus().run() - }}, + // IA Note (indices 14-17) { title: 'Clarifier', description: 'Rendre le texte plus clair', icon: Lightbulb, category: 'IA Note', isAi: true, aiOption: 'clarify', command: () => {} }, { title: 'Raccourcir', description: 'Condenser le texte', icon: Scissors, category: 'IA Note', isAi: true, aiOption: 'shorten', command: () => {} }, { title: 'Améliorer', description: 'Améliorer le style', icon: Wand2, category: 'IA Note', isAi: true, aiOption: 'improve', command: () => {} }, @@ -223,6 +219,7 @@ function ImageModal({ onConfirm, onCancel }: { onConfirm: (url: string) => void; } function BubbleToolbar({ editor }: { editor: Editor | null }) { + const { t } = useLanguage() const [, setTick] = useState(0) const [aiOpen, setAiOpen] = useState(false) const [aiLoading, setAiLoading] = useState(false) @@ -245,14 +242,14 @@ function BubbleToolbar({ editor }: { editor: Editor | null }) { if (!editor) return null const marks = [ - { icon: Bold, active: editor.isActive('bold'), action: () => editor.chain().focus().toggleBold().run(), title: 'Gras' }, - { icon: Italic, active: editor.isActive('italic'), action: () => editor.chain().focus().toggleItalic().run(), title: 'Italique' }, - { icon: UnderlineIcon, active: editor.isActive('underline'), action: () => editor.chain().focus().toggleUnderline().run(), title: 'Souligné' }, - { icon: Strikethrough, active: editor.isActive('strike'), action: () => editor.chain().focus().toggleStrike().run(), title: 'Barré' }, - { icon: Code, active: editor.isActive('code'), action: () => editor.chain().focus().toggleCode().run(), title: 'Code' }, - { icon: Highlighter, active: editor.isActive('highlight'), action: () => editor.chain().focus().toggleHighlight().run(), title: 'Surligner' }, - { icon: SuperscriptIcon, active: editor.isActive('superscript'), action: () => editor.chain().focus().toggleSuperscript().run(), title: 'Exposant' }, - { icon: SubscriptIcon, active: editor.isActive('subscript'), action: () => editor.chain().focus().toggleSubscript().run(), title: 'Indice' }, + { icon: Bold, active: editor.isActive('bold'), action: () => editor.chain().focus().toggleBold().run(), title: t('richTextEditor.bold') }, + { icon: Italic, active: editor.isActive('italic'), action: () => editor.chain().focus().toggleItalic().run(), title: t('richTextEditor.italic') }, + { icon: UnderlineIcon, active: editor.isActive('underline'), action: () => editor.chain().focus().toggleUnderline().run(), title: t('richTextEditor.underline') }, + { icon: Strikethrough, active: editor.isActive('strike'), action: () => editor.chain().focus().toggleStrike().run(), title: t('richTextEditor.strike') }, + { icon: Code, active: editor.isActive('code'), action: () => editor.chain().focus().toggleCode().run(), title: t('richTextEditor.code') }, + { icon: Highlighter, active: editor.isActive('highlight'), action: () => editor.chain().focus().toggleHighlight().run(), title: t('richTextEditor.highlight') }, + { icon: SuperscriptIcon, active: editor.isActive('superscript'), action: () => editor.chain().focus().toggleSuperscript().run(), title: t('richTextEditor.superscript') }, + { icon: SubscriptIcon, active: editor.isActive('subscript'), action: () => editor.chain().focus().toggleSubscript().run(), title: t('richTextEditor.subscript') }, ] const handleAI = async (option: 'clarify' | 'shorten' | 'improve') => { @@ -323,9 +320,9 @@ function BubbleToolbar({ editor }: { editor: Editor | null }) { {aiOpen && (