A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
feat: markdown file upload support (#1647) (#1672)
Rodrigo Santosecb13cec5d5c
diff --git a/apps/web/components/dashboard/UploadDropzone.tsx b/apps/web/components/dashboard/UploadDropzone.tsxindex df7bae0a..2bac005e 100644--- a/apps/web/components/dashboard/UploadDropzone.tsx+++ b/apps/web/components/dashboard/UploadDropzone.tsx@@ -45,8 +45,25 @@ export function useUploadAsset() {});return useCallback(- (file: File) => {- return runUploadAsset(file);+ async (file: File) => {+ // Handle markdown files as text bookmarks+ if (file.type === "text/markdown" || file.name.endsWith(".md")) {+ try {+ const content = await file.text();+ await createBookmark({+ type: BookmarkTypes.TEXT,+ text: content,+ title: file.name.replace(/\.md$/i, ""), // Remove .md extension from title+ });+ } catch {+ toast({+ description: `${file.name}: Failed to read markdown file`,+ variant: "destructive",+ });+ }+ } else {+ return runUploadAsset(file);+ }},[runUploadAsset],);@@ -134,7 +151,7 @@ export default function UploadDropzone({</div>) : (<p className="text-2xl font-bold text-gray-700">- Drop Your Image / Bookmark file+ Drop Your Image / PDF / Markdown file</p>)}</div>