feat: integrate luckysheet inline and fullscreen

This commit is contained in:
liaibo
2025-11-23 17:22:35 +08:00
parent c8e479aeab
commit 994dd4e67c
529 changed files with 403413 additions and 201 deletions
@@ -20,10 +20,12 @@ import {
Play,
Sparkles,
SquareCheckBig,
Table,
} from "lucide-react";
import type { CustomBlockSchema } from "../schema";
import { useImagePicker } from "@/components/media/image-picker-context";
import type { MediaKind, MediaSelection } from "@/types/media";
import { createOnlineTable } from "@/lib/online-table";
type Props = {
editor: BlockNoteEditor<CustomBlockSchema>;
@@ -134,6 +136,33 @@ export const CustomSlashMenu = ({ editor, currentDocumentId }: Props) => {
const cursor = editor.getTextCursorPosition();
const referenceBlock = cursor?.block ?? editor.topLevelBlocks[0];
const createTableItem: DefaultReactSuggestionItem = {
title: "在线表格",
group: "高级",
aliases: ["online table", "bg", "表格"],
icon: <Table className="h-4 w-4 text-[#0f172a]" />,
onItemClick: async () => {
const documentId = currentDocumentId;
try {
const newTable = await createOnlineTable(documentId);
editor.insertBlocks(
[
{
type: "onlineTable",
props: { tableId: newTable.id, title: newTable.title },
},
],
referenceBlock,
"after",
);
} catch (error) {
console.error("Failed to create table:", error);
// TODO: 插入错误提示块
}
},
};
const createPageItem: DefaultReactSuggestionItem = {
title: "嵌入页面",
group: "嵌入",
@@ -268,6 +297,7 @@ export const CustomSlashMenu = ({ editor, currentDocumentId }: Props) => {
...headingItems,
foldHeading,
createPageItem,
createTableItem,
advancedTodo,
foldAdvancedTodo,
progressMeter,