Repository navigation
feat: Excalidraw drawings inside notes - #99
Merged
Merged
Conversation
FabioHAraujo
force-pushed
the
feat/excalidraw-drawings
branch
from
October 29, 2026 16:04
f73aae4 to
7fe444c
Compare
Drawings live in the note as `excalidraw` code blocks, so sync, history and collaboration need no protocol change. The toolbar adds one and opens a full-screen canvas; the preview renders it and opens it on click; exports embed it as an image. Strokes from another device merge into an open drawing. Excalidraw and React load on demand, and its fonts are served by the app so the CSP stays unchanged. Closes #98
The canvas also keeps Excalidraw's own right-click menu; an e2e check covers it.
@excalidraw/excalidraw pins nanoid 3.3.3 and mermaid-to-excalidraw pins 4.0.2; both only import nanoid(), and docx bundles its own copy.
FabioHAraujo
force-pushed
the
feat/excalidraw-drawings
branch
from
October 29, 2026 20:19
a4dd92a to
1a1dcbf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #98
What
Excalidraw drawings inside notes, similar to Obsidian's Excalidraw plugin.
DrawingEditor.svelte). With the cursor inside an existing drawing it opens that one. A new drawing closed without strokes takes its text back out of the note.excalidrawfenced code block in the Markdown. Sync, history, trash and collaboration work unchanged; no Rust or protocol change.renderExportDiagramdispatches on the block language).Sync and merge
drawing-blocks.tsserializes one element per line and writes the smallest text change, so concurrent edits to different elements merge in the CRDT as valid JSON. While a drawing is open, remote changes to its block are merged into the canvas with Excalidraw'sreconcileElements, so they are not overwritten by the next local save. Deleted elements are kept for 24 hours so open editors on other devices learn about the deletion. A block damaged by a merge keeps every element line that still parses.CSP
The CSP is unchanged:
/excalidraw/fonts/) and rewrites that fallback to the same local path, in the build and in dev pre-bundling. The build fails if the fallback code changes in a future Excalidraw version.exportToCanvas. Excalidraw's SVG export subsets fonts with code that needsunsafe-eval.document.fonts, so CJK text uses system fonts.Limitations
Dependencies
@excalidraw/excalidraw0.18.1 (MIT),reactandreact-dom19.2.9, and their type packages.Tests
tests/drawing-blocks.test.ts: block discovery (lists, quotes, CRLF, unclosed fences), minimal changes, insertion, serialization, tombstones, concurrent appends, damaged content.tests/e2e/drawing.pw.ts: draw and save, toolbar insert and empty-close cleanup, remote strokes merged into an open drawing.tests/e2e/csp.pw.tsnow renders a drawing and opens the canvas with zero CSP violations.Run locally:
bun run check,bun run check:e2e,bun test(108 pass),bun run build,bun run test:e2e(37 pass),bun run version:check, Python script tests. No Rust changes.Not yet tried in the packaged Tauri app; the e2e suite runs in Chromium, the WebView2 engine.