Combined upload slash commands

This commit is contained in:
2026-03-17 18:47:53 -05:00
parent 94fce5652a
commit 8f8bd8dcac
7 changed files with 90 additions and 32 deletions
+5 -22
View File
@@ -1,5 +1,5 @@
import { type Component, createSignal, For, createEffect } from "solid-js";
import { Type, Code, Quote, ImageIcon, Heading1, Heading2, Heading3, List, ListTodo, Film, FileText, AppWindow, Minus, Grid3X3, Trash2 } from "lucide-solid";
import { Type, Code, Quote, Heading1, Heading2, Heading3, List, ListTodo, FileText, AppWindow, Minus, Grid3X3, Trash2 } from "lucide-solid";
import { cn } from "@/lib/utils";
export interface CommandItem {
@@ -80,29 +80,12 @@ export const getSuggestionItems = ({ query }: { query: string }): CommandItem[]
},
},
{
title: "Image",
description: "Upload an image.",
icon: ImageIcon,
command: ({ editor, range }: { editor: any, range: any }) => {
editor.chain().focus().deleteRange(range).uploadImage().run();
},
},
{
title: "Video",
description: "Upload a video.",
aliases: ["movie", "mp4", "mov"],
icon: Film,
command: ({ editor, range }: { editor: any, range: any }) => {
editor.chain().focus().deleteRange(range).uploadVideo().run();
},
},
{
title: "File",
description: "Upload a document or file.",
aliases: ["file", "pdf", "doc", "upload"],
title: "Media / File",
description: "Upload an image, video, or document.",
aliases: ["image", "video", "file", "upload", "pdf", "movie"],
icon: FileText,
command: ({ editor, range }: { editor: any, range: any }) => {
editor.chain().focus().deleteRange(range).uploadFile().run();
editor.chain().focus().deleteRange(range).uploadMedia().run();
},
},
{
+2 -6
View File
@@ -30,11 +30,9 @@ import { Dropcursor } from "@tiptap/extension-dropcursor";
import { Mention } from "@tiptap/extension-mention";
import { userSuggestion, noteSuggestion } from "@/lib/mention-suggestion";
import { FileViewer } from "@/lib/extensions/file-viewer";
import { ImageUpload } from "@/lib/extensions/image-upload";
import { Video } from "@/lib/extensions/video";
import { VideoUpload } from "@/lib/extensions/video-upload";
import { FileAttachment } from "@/lib/extensions/file-attachment";
import { FileUpload } from "@/lib/extensions/file-upload";
import { MediaUpload } from "@/lib/extensions/media-upload";
interface TaskEditorProps {
content?: string;
@@ -214,11 +212,9 @@ export const TaskEditor: Component<TaskEditorProps> = (props) => {
width: 2,
}),
FileViewer,
ImageUpload,
Video,
VideoUpload,
FileAttachment,
FileUpload,
MediaUpload,
],
// Use untrack so the editor doesn't re-initialize when props.content changes
content: untrack(() => props.content) || "",