Significant tiptap updates

This commit is contained in:
2026-02-28 17:11:33 -06:00
parent 5bf00de940
commit 6de09411a1
8 changed files with 546 additions and 5 deletions
+54 -1
View File
@@ -4,7 +4,10 @@ import {
List, ListTodo, Type,
Code, Quote,
Image as ImageIcon, Minus,
Bold, Italic, Underline
Bold, Italic, Underline,
Grid3X3, Highlighter,
AlignLeft, AlignCenter, AlignRight,
Trash2
} from "lucide-solid";
import { cn, convertImageToWebpFile } from "@/lib/utils";
import { activeTaskId, uploadTaskAttachment } from "@/store";
@@ -170,6 +173,56 @@ export const getSuggestionItems = ({ query }: { query: string }): CommandItem[]
editor.chain().focus().deleteRange(range).setHorizontalRule().run();
},
},
{
title: "Table",
description: "Insert a 3x3 table.",
aliases: ["grid", "table"],
icon: Grid3X3,
command: ({ editor, range }: { editor: any, range: any }) => {
editor.chain().focus().deleteRange(range).insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run();
},
},
{
title: "Highlight",
description: "Highlight selected text.",
aliases: ["mark"],
icon: Highlighter,
command: ({ editor, range }: { editor: any, range: any }) => {
editor.chain().focus().deleteRange(range).toggleHighlight().run();
},
},
{
title: "Align Left",
description: "Align text to the left.",
icon: AlignLeft,
command: ({ editor, range }: { editor: any, range: any }) => {
editor.chain().focus().deleteRange(range).setTextAlign("left").run();
},
},
{
title: "Align Center",
description: "Align text to the center.",
icon: AlignCenter,
command: ({ editor, range }: { editor: any, range: any }) => {
editor.chain().focus().deleteRange(range).setTextAlign("center").run();
},
},
{
title: "Align Right",
description: "Align text to the right.",
icon: AlignRight,
command: ({ editor, range }: { editor: any, range: any }) => {
editor.chain().focus().deleteRange(range).setTextAlign("right").run();
},
},
{
title: "Delete Table",
description: "Delete the entire table.",
icon: Trash2,
command: ({ editor, range }: { editor: any, range: any }) => {
editor.chain().focus().deleteRange(range).deleteTable().run();
},
},
].filter(item => {
const lowerQuery = query.toLowerCase();
return item.title.toLowerCase().startsWith(lowerQuery) ||