diff --git a/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx b/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx index c74fc3d88..5e2de58b4 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx @@ -1,10 +1,10 @@ -import { Button } from '@openfun/cunningham-react'; +import { Button, VariantType, useToastProvider } from '@openfun/cunningham-react'; import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Box, DropButton, IconOptions, Text } from '@/components'; import { useAuthStore } from '@/core'; -import { usePanelEditorStore } from '@/features/docs/doc-editor/'; +import { usePanelEditorStore, useDocStore } from '@/features/docs/doc-editor/'; import { Doc, ModalRemoveDoc, @@ -31,6 +31,24 @@ export const DocToolBox = ({ doc, versionId }: DocToolBoxProps) => { const [isModalVersionOpen, setIsModalVersionOpen] = useState(false); const { isSmallMobile } = useResponsiveStore(); const { authenticated } = useAuthStore(); + const { docsStore } = useDocStore(); + const { toast } = useToastProvider(); + + const getDocContentFormatted = (format: 'html'|'markdown'): Promise => { + const editor = docsStore[doc.id]?.editor; + if (!editor) { + return Promise.reject(new Error('Editor not available')); + } + + switch (format) { + case 'html': + return editor.blocksToHTMLLossy(); + case 'markdown': + return editor.blocksToMarkdownLossy(); + default: + return Promise.reject(new Error(`Unsupported format: ${format}`)); + } + } return ( { {t('Delete document')} )} + + diff --git a/src/frontend/apps/impress/src/i18n/translations.json b/src/frontend/apps/impress/src/i18n/translations.json index e5b501e12..9777b5f72 100644 --- a/src/frontend/apps/impress/src/i18n/translations.json +++ b/src/frontend/apps/impress/src/i18n/translations.json @@ -22,6 +22,8 @@ "Content modal to export the document": "Contenu modal pour exporter le document", "Cookies placed": "Cookies déposés", "Copy link": "Copier le lien", + "Copy as {{target}}": "Copier en {{target}}", + "Copied to clipboard": "Copié dans le presse-papiers", "Copyright": "Copyright", "Create a new document": "Créer un nouveau document", "Created at": "Créé le", @@ -49,6 +51,7 @@ "Export your document, it will be inserted in the selected template.": "Exportez votre document, il sera inséré dans le modèle sélectionné.", "Failed to add the member in the document.": "Impossible d'ajouter le membre dans le document.", "Failed to copy link": "Échec de la copie du lien", + "Failed to copy to clipboard": "Échec de la copie dans le presse-papiers", "Failed to create the invitation for {{email}}.": "Impossible de créer l'invitation pour {{email}}.", "Find a member to add to the document": "Trouver un membre à ajouter au document", "French Interministerial Directorate for Digital Affairs (DINUM), 20 avenue de Ségur 75007 Paris.": "Direction interministérielle des affaires numériques (DINUM), 20 avenue de Segur 75007 Paris.",