feat: excalidraw integration (#214)

* update tiptap version

* excalidraw init

* cleanup

* better file handling and other fixes

* use different modal to fix excalidraw cursor position issue
* see https://github.com/excalidraw/excalidraw/issues/7312
* fix websocket in vite dev mode

* WIP

* add align attribute

* fix table

* menu icons

* Render image in excalidraw html
* add size to custom SVG components

* rewrite undefined font urls
This commit is contained in:
Philip Okugbe
2024-08-31 19:11:07 +01:00
committed by GitHub
parent 77b541ec71
commit 38e9eef2dc
26 changed files with 1440 additions and 799 deletions

View File

@ -25,6 +25,8 @@ import {
import { uploadImageAction } from "@/features/editor/components/image/upload-image-action.tsx";
import { uploadVideoAction } from "@/features/editor/components/video/upload-video-action.tsx";
import { uploadAttachmentAction } from "@/features/editor/components/attachment/upload-attachment-action.tsx";
import IconExcalidraw from "@/components/icons/icon-excalidraw";
import IconMermaid from "@/components/icons/icon-mermaid";
const CommandGroups: SlashMenuGroupedItemsType = {
basic: [
@ -292,8 +294,8 @@ const CommandGroups: SlashMenuGroupedItemsType = {
{
title: "Mermaid diagram",
description: "Insert mermaid diagram",
searchTerms: ["mermaid", "diagram", "chart"],
icon: IconLetterY,
searchTerms: ["mermaid", "diagrams", "chart", "uml"],
icon: IconMermaid,
command: ({ editor, range }: CommandProps) =>
editor
.chain()
@ -302,6 +304,14 @@ const CommandGroups: SlashMenuGroupedItemsType = {
.setCodeBlock({ language: "mermaid" })
.run(),
},
{
title: "Excalidraw diagram",
description: "Draw and sketch excalidraw diagrams",
searchTerms: ["diagrams", "draw", "sketch"],
icon: IconExcalidraw,
command: ({ editor, range }: CommandProps) =>
editor.chain().focus().deleteRange(range).setExcalidraw().run(),
},
],
};