diff --git a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsx b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsx index a8b85e20b..5b7451c61 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsx @@ -24,7 +24,7 @@ import { } from "@/components/ui/dropdown-menu"; import type { Document } from "./types"; -const EDITABLE_DOCUMENT_TYPES = ["NOTE"] as const; +const EDITABLE_DOCUMENT_TYPES = ["FILE", "NOTE"] as const; // SURFSENSE_DOCS are system-managed and cannot be deleted const NON_DELETABLE_DOCUMENT_TYPES = ["SURFSENSE_DOCS"] as const; diff --git a/surfsense_web/components/documents/DocumentNode.tsx b/surfsense_web/components/documents/DocumentNode.tsx index a562703e8..79cf2233b 100644 --- a/surfsense_web/components/documents/DocumentNode.tsx +++ b/surfsense_web/components/documents/DocumentNode.tsx @@ -40,6 +40,8 @@ import type { DocumentTypeEnum } from "@/contracts/types/document.types"; import { cn } from "@/lib/utils"; import { DND_TYPES } from "./FolderNode"; +const EDITABLE_DOCUMENT_TYPES = new Set(["FILE", "NOTE"]); + export interface DocumentNodeDoc { id: number; title: string; @@ -78,7 +80,9 @@ export const DocumentNode = React.memo(function DocumentNode({ const statusState = doc.status?.state ?? "ready"; const isSelectable = statusState !== "pending" && statusState !== "processing"; const isEditable = - doc.document_type === "NOTE" && statusState !== "pending" && statusState !== "processing"; + EDITABLE_DOCUMENT_TYPES.has(doc.document_type) && + statusState !== "pending" && + statusState !== "processing"; const handleCheckChange = useCallback(() => { if (isSelectable) { diff --git a/surfsense_web/components/editor-panel/editor-panel.tsx b/surfsense_web/components/editor-panel/editor-panel.tsx index f2f66eb48..aff1367b0 100644 --- a/surfsense_web/components/editor-panel/editor-panel.tsx +++ b/surfsense_web/components/editor-panel/editor-panel.tsx @@ -5,6 +5,7 @@ import { AlertCircle, XIcon } from "lucide-react"; import { useCallback, useEffect, useRef, useState } from "react"; import { toast } from "sonner"; import { closeEditorPanelAtom, editorPanelAtom } from "@/atoms/editor/editor-panel.atom"; +import { MarkdownViewer } from "@/components/markdown-viewer"; import { PlateEditor } from "@/components/editor/plate-editor"; import { Button } from "@/components/ui/button"; import { Drawer, DrawerContent, DrawerHandle, DrawerTitle } from "@/components/ui/drawer"; @@ -18,6 +19,8 @@ interface EditorContent { source_markdown: string; } +const EDITABLE_DOCUMENT_TYPES = new Set(["FILE", "NOTE"]); + function EditorPanelSkeleton() { return (
Unsaved changes
)}{error || "An unknown error occurred"}