Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(editor): address review — complete migration, fix imports, clean dead code

Naiyuan Qingee46fd606467
diff --git a/packages/views/editor/content-editor.css b/packages/views/editor/content-editor.css
index 901184a675..4a1e1f0f57 100644
--- a/packages/views/editor/content-editor.css
+++ b/packages/views/editor/content-editor.css
@@ -457,24 +457,4 @@
.rich-text-editor .image-toolbar button:hover {
background: color-mix(in srgb, white 15%, transparent);
-}
-
-/* Drag-and-drop overlay */
-.editor-drop-overlay {
- position: absolute;
- inset: 0;
- display: flex;
- align-items: center;
- justify-content: center;
- border: 2px dashed color-mix(in srgb, var(--brand) 40%, transparent);
- border-radius: var(--radius);
- background: color-mix(in srgb, var(--brand) 3%, transparent);
- z-index: 10;
- pointer-events: none;
-}
-
-.editor-drop-overlay p {
- font-size: 0.875rem;
- font-weight: 500;
- color: color-mix(in srgb, var(--brand) 60%, transparent);
-}
+}
\ No newline at end of file
diff --git a/packages/views/editor/content-editor.tsx b/packages/views/editor/content-editor.tsx
index b3a0850ad2..f1fbc91030 100644
--- a/packages/views/editor/content-editor.tsx
+++ b/packages/views/editor/content-editor.tsx
@@ -30,7 +30,6 @@ import {
useEffect,
useImperativeHandle,
useRef,
- useState,
} from "react";
import { useEditor, EditorContent } from "@tiptap/react";
import { cn } from "@multica/ui/lib/utils";
@@ -55,8 +54,6 @@ interface ContentEditorProps {
onSubmit?: () => void;
onBlur?: () => void;
onUploadFile?: (file: File) => Promise<UploadResult | null>;
- /** When false, suppresses the internal drag-over overlay so the parent can render its own. Default true. */
- showDropOverlay?: boolean;
}
interface ContentEditorRef {
@@ -82,11 +79,9 @@ const ContentEditor = forwardRef<ContentEditorRef, ContentEditorProps>(
onSubmit,
onBlur,
onUploadFile,
- showDropOverlay = true,
},
ref,
) {
- const [dragOver, setDragOver] = useState(false);
const debounceRef = useRef<ReturnType<typeof setTimeout>>(undefined);
const onUpdateRef = useRef(onUpdate);
const onSubmitRef = useRef(onSubmit);
@@ -181,18 +176,6 @@ const ContentEditor = forwardRef<ContentEditorRef, ContentEditorProps>(
};
}, []);
- // Always clear drag overlay on any drop/dragend anywhere in the document
- useEffect(() => {
- if (!showDropOverlay) return;
- const clear = () => setDragOver(false);
- document.addEventListener("drop", clear);
- document.addEventListener("dragend", clear);
- return () => {
- document.removeEventListener("drop", clear);
- document.removeEventListener("dragend", clear);
- };
- }, [showDropOverlay]);
-
// Readonly content update: when defaultValue changes and editor is readonly,
// re-set the content (e.g. after editing a comment, the readonly view updates)
useEffect(() => {
@@ -225,52 +208,8 @@ const ContentEditor = forwardRef<ContentEditorRef, ContentEditorProps>(
if (!editor) return null;
return (
- <div
- className={cn(
- "relative min-h-full",
- showDropOverlay && dragOver && "editor-drag-over",
- )}
- {...(showDropOverlay
- ? {
- onDragEnter: (e: React.DragEvent) => {
- e.preventDefault();
- if (editable && e.dataTransfer.types.includes("Files"))
- setDragOver(true);
- },
- onDragOver: (e: React.DragEvent) => {
- e.preventDefault();
- },
- onDragLeave: (e: React.DragEvent) => {
- if (!e.currentTarget.contains(e.relatedTarget as Node))
- setDragOver(false);
- },
- onDrop: (e: React.DragEvent) => {
- const alreadyHandled = e.nativeEvent.defaultPrevented;
- e.preventDefault();
- setDragOver(false);
- if (alreadyHandled) return;
- const files = e.dataTransfer?.files;
- if (files?.length && editor && onUploadFileRef.current) {
- const endPos = editor.state.doc.content.size;
- for (const file of Array.from(files)) {
- uploadAndInsertFile(
- editor,
- file,
- onUploadFileRef.current,
- endPos,
- );
- }
- }
- },
- }
- : {})}
- >
+ <div className="relative min-h-full">
<EditorContent editor={editor} />
- {showDropOverlay && dragOver && (
- <div className="editor-drop-overlay">
- <p>Drop files to upload</p>
- </div>
- )}
</div>
);
},
diff --git a/packages/views/issues/components/comment-card.tsx b/packages/views/issues/components/comment-card.tsx
index 4732ef2a45..31bc7c112a 100644
--- a/packages/views/issues/components/comment-card.tsx
+++ b/packages/views/issues/components/comment-card.tsx
@@ -30,9 +30,7 @@ import { QuickEmojiPicker } from "@multica/ui/components/common/quick-emoji-pick
import { cn } from "@multica/ui/lib/utils";
import { useActorName } from "@multica/core/workspace/hooks";
import { timeAgo } from "@multica/core/utils";
-import { ContentEditor, type ContentEditorRef, copyMarkdown, ReadonlyContent } from "../../editor";
-import { useFileDropZone } from "../../editor/use-file-drop-zone";
-import { FileDropOverlay } from "../../editor/file-drop-overlay";
+import { ContentEditor, type ContentEditorRef, copyMarkdown, ReadonlyContent, useFileDropZone, FileDropOverlay } from "../../editor";
import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";
import { useFileUpload } from "@multica/core/hooks/use-file-upload";
import { api } from "@multica/core/api";
@@ -238,7 +236,6 @@ function CommentRow({
placeholder="Edit comment..."
onSubmit={saveEdit}
onUploadFile={(file) => uploadWithToast(file, { issueId })}
- showDropOverlay={false}
debounceMs={100}
/>
</div>
@@ -455,7 +452,6 @@ function CommentCard({
placeholder="Edit comment..."
onSubmit={saveEdit}
onUploadFile={(file) => uploadWithToast(file, { issueId })}
- showDropOverlay={false}
debounceMs={100}
/>
</div>
diff --git a/packages/views/issues/components/comment-input.tsx b/packages/views/issues/components/comment-input.tsx
index 88090c1c82..efd87dafa8 100644
--- a/packages/views/issues/components/comment-input.tsx
+++ b/packages/views/issues/components/comment-input.tsx
@@ -3,10 +3,7 @@
import { useRef, useState } from "react";
import { ArrowUp, Loader2 } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import { ContentEditor, type ContentEditorRef } from "../../editor";
-import { useFileDropZone } from "../../editor/use-file-drop-zone";
-import { FileDropOverlay } from "../../editor/file-drop-overlay";
+import { ContentEditor, type ContentEditorRef, useFileDropZone, FileDropOverlay } from "../../editor";
import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";
import { useFileUpload } from "@multica/core/hooks/use-file-upload";
import { api } from "@multica/core/api";
@@ -51,10 +48,7 @@ function CommentInput({ issueId, onSubmit }: CommentInputProps) {
return (
<div
{...dropZoneProps}
- className={cn(
- "relative flex max-h-56 flex-col rounded-lg bg-card pb-8 ring-1 ring-border",
- isDragOver && "ring-brand/30",
- )}
+ className="relative flex max-h-56 flex-col rounded-lg bg-card pb-8 ring-1 ring-border"
>
<div className="flex-1 min-h-0 overflow-y-auto px-3 py-2">
<ContentEditor
@@ -63,7 +57,6 @@ function CommentInput({ issueId, onSubmit }: CommentInputProps) {
onUpdate={(md) => setIsEmpty(!md.trim())}
onSubmit={handleSubmit}
onUploadFile={handleUpload}
- showDropOverlay={false}
debounceMs={100}
/>
</div>
diff --git a/packages/views/issues/components/issue-detail.test.tsx b/packages/views/issues/components/issue-detail.test.tsx
index c99957bbeb..e18303d30c 100644
--- a/packages/views/issues/components/issue-detail.test.tsx
+++ b/packages/views/issues/components/issue-detail.test.tsx
@@ -85,6 +85,8 @@ vi.mock("../../navigation", () => ({
// Mock editor components (Tiptap requires real DOM)
vi.mock("../../editor", () => ({
+ useFileDropZone: () => ({ isDragOver: false, dropZoneProps: {} }),
+ FileDropOverlay: () => null,
ReadonlyContent: ({ content }: { content: string }) => (
<div data-testid="readonly-content">{content}</div>
),
diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsx
index 89e6dbc83d..87e509d057 100644
--- a/packages/views/issues/components/issue-detail.tsx
+++ b/packages/views/issues/components/issue-detail.tsx
@@ -41,11 +41,8 @@ import {
DropdownMenuSubContent,
} from "@multica/ui/components/ui/dropdown-menu";
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "@multica/ui/components/ui/resizable";
-import { ContentEditor, type ContentEditorRef } from "../../editor";
-import { useFileDropZone } from "../../editor/use-file-drop-zone";
-import { FileDropOverlay } from "../../editor/file-drop-overlay";
+import { ContentEditor, type ContentEditorRef, TitleEditor, useFileDropZone, FileDropOverlay } from "../../editor";
import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";
-import { TitleEditor } from "../../editor";
import {
Tooltip,
TooltipTrigger,
@@ -715,7 +712,6 @@ export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layo
placeholder="Add description..."
onUpdate={(md) => handleUpdateField({ description: md || undefined })}
onUploadFile={handleDescriptionUpload}
- showDropOverlay={false}
debounceMs={1500}
/>
diff --git a/packages/views/issues/components/reply-input.tsx b/packages/views/issues/components/reply-input.tsx
index 4a4bc96118..80fbf3bc5e 100644
--- a/packages/views/issues/components/reply-input.tsx
+++ b/packages/views/issues/components/reply-input.tsx
@@ -2,9 +2,7 @@
import { useRef, useState, useEffect } from "react";
import { ArrowUp, Loader2 } from "lucide-react";
-import { ContentEditor, type ContentEditorRef } from "../../editor";
-import { useFileDropZone } from "../../editor/use-file-drop-zone";
-import { FileDropOverlay } from "../../editor/file-drop-overlay";
+import { ContentEditor, type ContentEditorRef, useFileDropZone, FileDropOverlay } from "../../editor";
import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";
import { ActorAvatar } from "../../common/actor-avatar";
import { useFileUpload } from "@multica/core/hooks/use-file-upload";
@@ -106,7 +104,6 @@ function ReplyInput({
onUpdate={(md) => setIsEmpty(!md.trim())}
onSubmit={handleSubmit}
onUploadFile={handleUpload}
- showDropOverlay={false}
debounceMs={100}
/>
</div>
diff --git a/packages/views/modals/create-issue.tsx b/packages/views/modals/create-issue.tsx
index 65a977216e..4c437d7b7c 100644
--- a/packages/views/modals/create-issue.tsx
+++ b/packages/views/modals/create-issue.tsx
@@ -13,10 +13,7 @@ import {
} from "@multica/ui/components/ui/dialog";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
import { Button } from "@multica/ui/components/ui/button";
-import { ContentEditor, type ContentEditorRef } from "../editor";
-import { useFileDropZone } from "../editor/use-file-drop-zone";
-import { FileDropOverlay } from "../editor/file-drop-overlay";
-import { TitleEditor } from "../editor";
+import { ContentEditor, type ContentEditorRef, TitleEditor, useFileDropZone, FileDropOverlay } from "../editor";
import { StatusIcon, StatusPicker, PriorityPicker, AssigneePicker, DueDatePicker } from "../issues/components";
import { ProjectPicker } from "../projects/components/project-picker";
import { useWorkspaceStore } from "@multica/core/workspace";
@@ -227,7 +224,6 @@ export function CreateIssueModal({ onClose, data }: { onClose: () => void; data?
placeholder="Add description..."
onUpdate={(md) => setDraft({ description: md })}
onUploadFile={handleUpload}
- showDropOverlay={false}
debounceMs={500}
/>
{descDragOver && <FileDropOverlay />}