aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/components/dashboard')
-rw-r--r--apps/web/components/dashboard/UploadDropzone.tsx23
1 files changed, 20 insertions, 3 deletions
diff --git a/apps/web/components/dashboard/UploadDropzone.tsx b/apps/web/components/dashboard/UploadDropzone.tsx
index 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>