feat: upgrade to Excalidraw 0.18.0 with legacy file compatibility#489
feat: upgrade to Excalidraw 0.18.0 with legacy file compatibility#489Technophobe01 wants to merge 9 commits intobric3:mainfrom
Conversation
- Migrate from react-scripts to Vite for faster builds - Add preprocessLegacyElements() to fix rendering of old .excalidraw files - Fix missing lineHeight, autoResize, frameId, and boundElements fields - Update TypeScript and dependency configurations - Update font path regex for 0.18.0 asset structure
- Use loadFromBlob API in update handler to let Excalidraw handle format normalization internally (fixes menu disappearing issue) - Add arrow binding format conversion for legacy files - Remove unused restoreElements import - Clean up debug logging - Disable debug mode
MockK 1.14.x requires Kotlin 2.0+ and was pulling in kotlin-stdlib 2.1.20, which has metadata version 2.1.0. The project compiles with Kotlin 1.9.22, which expects metadata version 1.9.0, causing test compilation to fail. Changes: - Downgrade MockK from 1.14.4 to 1.13.16 (compatible with Kotlin 1.9.x) - Remove deprecated instrumentationTools() call (no longer necessary in IntelliJ Platform Gradle Plugin 2.x as instrumentation is now handled automatically when using testFramework())
There was a problem hiding this comment.
This is awesome !
So many thanks for doing it !
I noticed a few issue though, possibly due to how Excalidraw 0.18 works.
-
For example, the plugin used the current IDE theme when opening an Excalidraw file. With this change it doesn't seem to be the case
-
Embedded excalidraw in SVG file don't seem to load (
hello-export-with-scene.svg), there's a tab on the bottom of the editor to switch to excalidraw.java.lang.Throwable: hello-export-with-scene.svg: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/assets/index-B5dKs5In.js:40679]: Error loading file: SyntaxError: Unexpected token '<', "<svg versi"... is not valid JSON at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376) at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219) at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:301) at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:733) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131) at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:733) at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:738) at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:300) at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354) -
Or PNG for that matter (
random.png)java.lang.Throwable: random.png: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/assets/index-B5dKs5In.js:40679]: Error loading file: SyntaxError: Unexpected token '�', "�PNG � ��"... is not valid JSON at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376) at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219) at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:301) at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:733) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131) at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:733) at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:738) at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:300) at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354) -
Got this error :
java.lang.Throwable: invalid.excalidraw: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/assets/index-B5dKs5In.js:40647]: Error in update handler: TypeError: Cannot read properties of undefined (reading 'length') at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376) at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219) at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:301) at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:733) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131) at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:733) at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:738) at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:300) at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354)
Out of scope note:
- Embedded images in Excalidraw do not work yet so there's likely something else to do on this front. See #200
| uri.path.endsWith(".html") -> response.mimeType = "text/html" | ||
| uri.path.endsWith(".js") -> response.mimeType = "application/javascript" | ||
| uri.path.endsWith(".css") -> response.mimeType = "text/css" | ||
| uri.path.endsWith(".svg") -> response.mimeType = "image/svg+xml" | ||
| uri.path.endsWith(".png") -> response.mimeType = "image/png" | ||
| uri.path.endsWith(".jpg") || uri.path.endsWith(".jpeg") -> response.mimeType = "image/jpeg" | ||
| uri.path.endsWith(".gif") -> response.mimeType = "image/gif" | ||
| uri.path.endsWith(".webp") -> response.mimeType = "image/webp" | ||
| // Font MIME types for Excalidraw 0.18.0 self-hosted fonts | ||
| uri.path.endsWith(".woff") -> response.mimeType = "font/woff" | ||
| uri.path.endsWith(".woff2") -> response.mimeType = "font/woff2" | ||
| uri.path.endsWith(".ttf") -> response.mimeType = "font/ttf" | ||
| uri.path.endsWith(".otf") -> response.mimeType = "font/otf" | ||
| uri.path.endsWith(".eot") -> response.mimeType = "application/vnd.ms-fontobject" | ||
| // JSON for any config files | ||
| uri.path.endsWith(".json") -> response.mimeType = "application/json" |
There was a problem hiding this comment.
thought: In a future work this might be a good idea to extract the mapping to some configuration file.
There was a problem hiding this comment.
Noted for future work.
| val debugMode = ProcessHandle.current().info().arguments().map { | ||
| it.any { arg -> arg.contains("-agentlib:jdwp") } | ||
| }.orElse(false)!! | ||
| val debugMode = false |
There was a problem hiding this comment.
chore: To revert, ideally I'd like to keep this.
| * https://github.com/excalidraw/excalidraw/issues/7543 | ||
| * | ||
| * Updated for Excalidraw 0.18.0 where font paths changed from | ||
| * dist/excalidraw-assets/ to fonts/ |
There was a problem hiding this comment.
nitpick:
| * dist/excalidraw-assets/ to fonts/ | |
| * `dist/excalidraw-assets/` to `fonts/` |
project-fixture/test.excalidraw
Outdated
There was a problem hiding this comment.
chore: Rename test.excalidrow to zero-bytes.excalidraw.
There was a problem hiding this comment.
By the way opening that file generates the following error:
This is unrelated to this work, but I'd like to mention it, so at some point it can be picked up.
java.lang.Throwable: test.excalidraw: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/index.html:1]:
Uncaught SyntaxError: Unexpected end of JSON input
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219)
at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:301)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:733)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:733)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:738)
at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:300)
at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354)
There was a problem hiding this comment.
Done in 582c08c - renamed to zero-bytes.excalidraw
.gitignore
Outdated
| ./project-fixture/.idea/workspace.xml | ||
|
|
||
| # Claude Code | ||
| CLAUDE.md No newline at end of file |
There was a problem hiding this comment.
suggestion: If claude helped there, maybe that's worth havng that file here. However I'd rather have a standard AGENTS.md file and tell claude to point to it.
There was a problem hiding this comment.
Removed in c884923. Will consider AGENTS.md for future.
| .first() ?: defaultPort | ||
| } | ||
| // PORT is configured in vite.config.ts, defaulting to 3006 | ||
| 3006 |
There was a problem hiding this comment.
note: For future work maybe this can be extracted from the vite.config.ts file, or some other file that both vite and gradle can read.
There was a problem hiding this comment.
Noted for future work.
| module.exports = function override(config, env) { | ||
| // see https://webpack.js.org/configuration/ | ||
| console.log("config-overrides.js: Disabling build minimizer"); | ||
| config.mode = "development"; | ||
| config.optimization.minimize = false; | ||
| config.optimization.minimizer = []; | ||
|
|
||
| // https://webpack.js.org/configuration/devtool/ | ||
| console.log("config-overrides.js: Set devtool inline SourceMaps"); | ||
| config.devtool = "inline-source-map" | ||
|
|
||
| // There seem to be a bug in CRA 5 that causes warnings about source maps | ||
| // Disable the warning for now | ||
| // Discussion of the bug: https://github.com/facebook/create-react-app/discussions/11767 | ||
| // PR supposed to fix the issue: https://github.com/facebook/create-react-app/pull/11752 | ||
| console.log("config-overrides.js: Ignoring source map warning https://github.com/facebook/create-react-app/discussions/11767"); | ||
| config.ignoreWarnings = [/Failed to parse source map/]; | ||
|
|
||
| return config; | ||
| }; |
There was a problem hiding this comment.
question: How does that work in practice without ? the vite config appear simpler and working?
There was a problem hiding this comment.
Removed - project migrated from webpack (CRA) to Vite. The vite.config.ts handles build configuration now.
There was a problem hiding this comment.
suggestion: Maybe rename after what should be looked at in this file.
There was a problem hiding this comment.
Left as-is - the name already describes its content (scan sequence diagram).
|
By the way you can prepare an entry in the Changelog.md file as well, you can mention yourself there :) |
|
Brice,
Hey, thanks for the feedback.
---
From: Brice Dutheil ***@***.***>
Date: Thursday, December 18, 2025 at 14:50
To: bric3/excalidraw-jetbrains-plugin ***@***.***>
Cc: Peter Jarvis ***@***.***>, Author ***@***.***>
Subject: Re: [bric3/excalidraw-jetbrains-plugin] feat: upgrade to Excalidraw 0.18.0 with legacy file compatibility (PR #489)
@bric3 commented on this pull request.
This is awesome !
So many thanks for doing it !
I noticed a few issue though, possibly due to how Excalidraw 0.18 works.
* For example, the plugin used the current IDE theme when opening an Excalidraw file. With this change it doesn't seem to be the case
* Embedded excalidraw in SVG file don't seem to load (hello-export-with-scene.svg)
· java.lang.Throwable: hello-export-with-scene.svg: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/assets/index-B5dKs5In.js:40679]:
· Error loading file: SyntaxError: Unexpected token '<', "<svg versi"... is not valid JSON
· at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
· at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219)
· at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:301)
· at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:733)
· at java.base/java.lang.Iterable.forEach(Iterable.java:75)
· at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131)
· at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:733)
· at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:738)
· at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:300)
· at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354)
________________________________
In plugin/src/main/kotlin/com/github/bric3/excalidraw/editor/SchemeHandlerFactory.kt<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632810749&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=HLy04YFGZoZhOeYbIaqL8tQxsS1f3GXByTYMs8sFYyU&e=>:
@@ -41,6 +41,17 @@ class SchemeHandlerFactory(val getStream: (uri: URI) -> InputStream?) : CefSchem
uri.path.endsWith(".css") -> response.mimeType = "text/css"
uri.path.endsWith(".svg") -> response.mimeType = "image/svg+xml"
uri.path.endsWith(".png") -> response.mimeType = "image/png"
+ uri.path.endsWith(".jpg") || uri.path.endsWith(".jpeg") -> response.mimeType = "image/jpeg"
+ uri.path.endsWith(".gif") -> response.mimeType = "image/gif"
+ uri.path.endsWith(".webp") -> response.mimeType = "image/webp"
+ // Font MIME types for Excalidraw 0.18.0 self-hosted fonts
+ uri.path.endsWith(".woff") -> response.mimeType = "font/woff"
+ uri.path.endsWith(".woff2") -> response.mimeType = "font/woff2"
+ uri.path.endsWith(".ttf") -> response.mimeType = "font/ttf"
+ uri.path.endsWith(".otf") -> response.mimeType = "font/otf"
+ uri.path.endsWith(".eot") -> response.mimeType = "application/vnd.ms-fontobject"
+ // JSON for any config files
+ uri.path.endsWith(".json") -> response.mimeType = "application/json"
thought: In a future work this might be a good idea to extract the mapping to some configuration file.
________________________________
In plugin/src/main/kotlin/com/github/bric3/excalidraw/utils.kt<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632823182&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=SUL9wYP9NQZ7bi1STpxOz9fIGqTwtHMoGDa3vGw0Gy4&e=>:
@@ -19,9 +19,7 @@ import java.util.function.Supplier
private val logger = Logger.getInstance("com.github.bric3.excalidraw.utils")
-val debugMode = ProcessHandle.current().info().arguments().map {
- it.any { arg -> arg.contains("-agentlib:jdwp") }
-}.orElse(false)!!
+val debugMode = false
chore: To revert, ideally I'd like to keep this.
________________________________
In plugin/src/main/kotlin/com/github/bric3/excalidraw/utils.kt<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632824651&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=bCB-aRsUvfyLYFdZFoA6Cmd1dzgrZ7TY22EvHZZ1JlQ&e=>:
@@ -109,8 +107,11 @@ suspend fun writePayloadToDocument(
* instead of regular `excalidraw.com`.
*
* excalidraw/excalidraw#7543
+ *
+ * Updated for Excalidraw 0.18.0 where font paths changed from
+ * dist/excalidraw-assets/ to fonts/
nitpick:
⬇️ Suggested change
- * dist/excalidraw-assets/ to fonts/
+ * `dist/excalidraw-assets/` to `fonts/`
________________________________
On project-fixture/test.excalidraw<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632829264&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=kL1wLRbjSuFkSJztpqqMsxThiCAPD2IgFJCuHj46LeM&e=>:
chore: Rename test.excalidrow to zero-bytes.excalidraw.
________________________________
In .gitignore<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632832696&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=ebOPLIE6QZjzBij-Yr3mn7GWOxEPh1vNOJxDmd_L92s&e=>:
\ No newline at end of file
+./project-fixture/.idea/workspace.xml
+
+# Claude Code
+CLAUDE.md
suggestion: If claude helped there, maybe that's worth havng that file here. However I'd rather have a standard AGENTS.md file and tell claude to point to it.
________________________________
In excalidraw-assets/build.gradle.kts<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632836435&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=PoT9CDxRXI1TAvWX8PDX3VHR2zUsX5xxeaLN5my7Y1U&e=>:
verboseModeEnabled.set(true)
}
val port = providers.provider {
- // PORT might be is in package.json "/scripts/start" value
- // dumb solution to extract the port if possible
- val defaultPort = 3000
- file("package.json").useLines { lines ->
- val startScriptRegex = Regex("\"start\"\\s?:\\s?\"[^\"]+\"")
- lines
- .filter { startScriptRegex.containsMatchIn(it) }
- .map { Regex("\".*PORT=(\\d+).*\"").find(it)?.groups?.get(1)?.value }
- .map { it?.toInt() }
- .first() ?: defaultPort
- }
+ // PORT is configured in vite.config.ts, defaulting to 3006
+ 3006
note: For future work maybe this can be extracted from the vite.config.ts file, or some other file that both vite and gradle can read.
________________________________
In excalidraw-assets/config-overrides.js<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632871137&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=49FA1Wmp0R_T9ZY25Y8BFTJBRg4vxmbKakv61pkQ5wA&e=>:
-module.exports = function override(config, env) {
- // see https://webpack.js.org/configuration/
- console.log("config-overrides.js: Disabling build minimizer");
- config.mode = "development";
- config.optimization.minimize = false;
- config.optimization.minimizer = [];
-
- // https://webpack.js.org/configuration/devtool/
- console.log("config-overrides.js: Set devtool inline SourceMaps");
- config.devtool = "inline-source-map"
-
- // There seem to be a bug in CRA 5 that causes warnings about source maps
- // Disable the warning for now
- // Discussion of the bug: facebook/create-react-app#11767
- // PR supposed to fix the issue: facebook/create-react-app#11752
- console.log("config-overrides.js: Ignoring source map warning facebook/create-react-app#11767");
- config.ignoreWarnings = [/Failed to parse source map/];
-
- return config;
-};
question: How does that work in practice without ? the vite config appear simpler and working?
…________________________________
On project-fixture/scan-sequence.excalidraw<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632873384&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=DmHPZlcSEgxqy0epFm6JtEyaSX3xp2hO-c4A8pk0WzE&e=>:
suggestion: Maybe rename after what should be looked at in this file.
________________________________
On project-fixture/test.excalidraw<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632850026&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=doLsC0Xzu0keMgYx6gAKRaY18oukkncb1nLDsTV8_t0&e=>:
By the way opening that file generates the following error:
This is unrelated to this work, but I'd like to mention it, so at some point it can be picked up.
java.lang.Throwable: test.excalidraw: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/index.html:1]:
Uncaught SyntaxError: Unexpected end of JSON input
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219)
at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:301)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:733)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:733)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:738)
at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:300)
at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354)
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23pullrequestreview-2D3595316794&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=rZ3B8XHnuSTVAQprjs-JEBjhzN8iZKg-clmNETocI-0&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AAFW5LWWDCRMKAENAGIUCZ34CMVUNAVCNFSM6AAAAACO7KGPZSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKOJVGMYTMNZZGQ&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=UhC8MHyagw_eJLbUfDEJC969Yi0Xc0W4ZnDtp2DgNms&e=>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
- Restore ProcessHandle-based debug mode detection - Add backticks around font paths in KDoc comment Signed-off-by: Technophobe01 <pkjarvis01@gmail.com>
Signed-off-by: Technophobe01 <pkjarvis01@gmail.com>
- Add tryReadSvgExcalidrawScene() to extract base64 payload from SVG - Update pngHasEmbeddedScene() to cache extracted scene data - Scheme handler serves decoded JSON instead of raw file content Signed-off-by: Technophobe01 <pkjarvis01@gmail.com>
Add dynamic theme--light/theme--dark class to wrapper element. Required for Excalidraw 0.18.0 CSS theming to work correctly. Signed-off-by: Technophobe01 <pkjarvis01@gmail.com>
Update load-from-file handler to detect and handle both: - Regular Excalidraw JSON files - Encoded/compressed payloads from embedded SVG/PNG scenes Signed-off-by: Technophobe01 <pkjarvis01@gmail.com>
Signed-off-by: Technophobe01 <pkjarvis01@gmail.com>
|
Brice,
As requested, I split the PR into two PR.
You’ll need to merge PR 491 before PR 492. Why? PR #492 requires the Kotlin fix to build, but the fix is now in PR #491.
---
From: Peter Jarvis ***@***.***>
Date: Sunday, December 21, 2025 at 14:48
To: bric3/excalidraw-jetbrains-plugin ***@***.***>, bric3/excalidraw-jetbrains-plugin ***@***.***>
Cc: Author ***@***.***>
Subject: Re: [bric3/excalidraw-jetbrains-plugin] feat: upgrade to Excalidraw 0.18.0 with legacy file compatibility (PR #489)
Brice,
Hey, thanks for the feedback.
---
From: Brice Dutheil ***@***.***>
Date: Thursday, December 18, 2025 at 14:50
To: bric3/excalidraw-jetbrains-plugin ***@***.***>
Cc: Peter Jarvis ***@***.***>, Author ***@***.***>
Subject: Re: [bric3/excalidraw-jetbrains-plugin] feat: upgrade to Excalidraw 0.18.0 with legacy file compatibility (PR #489)
@bric3 commented on this pull request.
This is awesome !
So many thanks for doing it !
I noticed a few issue though, possibly due to how Excalidraw 0.18 works.
* For example, the plugin used the current IDE theme when opening an Excalidraw file. With this change it doesn't seem to be the case
* Embedded excalidraw in SVG file don't seem to load (hello-export-with-scene.svg)
java.lang.Throwable: hello-export-with-scene.svg: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/assets/index-B5dKs5In.js:40679]:
Error loading file: SyntaxError: Unexpected token '<', "<svg versi"... is not valid JSON
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219)
at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:301)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:733)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:733)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:738)
at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:300)
at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354)
________________________________
In plugin/src/main/kotlin/com/github/bric3/excalidraw/editor/SchemeHandlerFactory.kt<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632810749&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=HLy04YFGZoZhOeYbIaqL8tQxsS1f3GXByTYMs8sFYyU&e=>:
@@ -41,6 +41,17 @@ class SchemeHandlerFactory(val getStream: (uri: URI) -> InputStream?) : CefSchem
uri.path.endsWith(".css") -> response.mimeType = "text/css"
uri.path.endsWith(".svg") -> response.mimeType = "image/svg+xml"
uri.path.endsWith(".png") -> response.mimeType = "image/png"
+ uri.path.endsWith(".jpg") || uri.path.endsWith(".jpeg") -> response.mimeType = "image/jpeg"
+ uri.path.endsWith(".gif") -> response.mimeType = "image/gif"
+ uri.path.endsWith(".webp") -> response.mimeType = "image/webp"
+ // Font MIME types for Excalidraw 0.18.0 self-hosted fonts
+ uri.path.endsWith(".woff") -> response.mimeType = "font/woff"
+ uri.path.endsWith(".woff2") -> response.mimeType = "font/woff2"
+ uri.path.endsWith(".ttf") -> response.mimeType = "font/ttf"
+ uri.path.endsWith(".otf") -> response.mimeType = "font/otf"
+ uri.path.endsWith(".eot") -> response.mimeType = "application/vnd.ms-fontobject"
+ // JSON for any config files
+ uri.path.endsWith(".json") -> response.mimeType = "application/json"
thought: In a future work this might be a good idea to extract the mapping to some configuration file.
________________________________
In plugin/src/main/kotlin/com/github/bric3/excalidraw/utils.kt<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632823182&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=SUL9wYP9NQZ7bi1STpxOz9fIGqTwtHMoGDa3vGw0Gy4&e=>:
@@ -19,9 +19,7 @@ import java.util.function.Supplier
private val logger = Logger.getInstance("com.github.bric3.excalidraw.utils")
-val debugMode = ProcessHandle.current().info().arguments().map {
- it.any { arg -> arg.contains("-agentlib:jdwp") }
-}.orElse(false)!!
+val debugMode = false
chore: To revert, ideally I'd like to keep this.
________________________________
In plugin/src/main/kotlin/com/github/bric3/excalidraw/utils.kt<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632824651&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=bCB-aRsUvfyLYFdZFoA6Cmd1dzgrZ7TY22EvHZZ1JlQ&e=>:
@@ -109,8 +107,11 @@ suspend fun writePayloadToDocument(
* instead of regular `excalidraw.com`.
*
* excalidraw/excalidraw#7543
+ *
+ * Updated for Excalidraw 0.18.0 where font paths changed from
+ * dist/excalidraw-assets/ to fonts/
nitpick:
⬇️ Suggested change
- * dist/excalidraw-assets/ to fonts/
+ * `dist/excalidraw-assets/` to `fonts/`
________________________________
On project-fixture/test.excalidraw<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632829264&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=kL1wLRbjSuFkSJztpqqMsxThiCAPD2IgFJCuHj46LeM&e=>:
chore: Rename test.excalidrow to zero-bytes.excalidraw.
________________________________
In .gitignore<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632832696&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=ebOPLIE6QZjzBij-Yr3mn7GWOxEPh1vNOJxDmd_L92s&e=>:
\ No newline at end of file
+./project-fixture/.idea/workspace.xml
+
+# Claude Code
+CLAUDE.md
suggestion: If claude helped there, maybe that's worth havng that file here. However I'd rather have a standard AGENTS.md file and tell claude to point to it.
________________________________
In excalidraw-assets/build.gradle.kts<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632836435&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=PoT9CDxRXI1TAvWX8PDX3VHR2zUsX5xxeaLN5my7Y1U&e=>:
verboseModeEnabled.set(true)
}
val port = providers.provider {
- // PORT might be is in package.json "/scripts/start" value
- // dumb solution to extract the port if possible
- val defaultPort = 3000
- file("package.json").useLines { lines ->
- val startScriptRegex = Regex("\"start\"\\s?:\\s?\"[^\"]+\"")
- lines
- .filter { startScriptRegex.containsMatchIn(it) }
- .map { Regex("\".*PORT=(\\d+).*\"").find(it)?.groups?.get(1)?.value }
- .map { it?.toInt() }
- .first() ?: defaultPort
- }
+ // PORT is configured in vite.config.ts, defaulting to 3006
+ 3006
note: For future work maybe this can be extracted from the vite.config.ts file, or some other file that both vite and gradle can read.
________________________________
In excalidraw-assets/config-overrides.js<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632871137&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=49FA1Wmp0R_T9ZY25Y8BFTJBRg4vxmbKakv61pkQ5wA&e=>:
-module.exports = function override(config, env) {
- // see https://webpack.js.org/configuration/
- console.log("config-overrides.js: Disabling build minimizer");
- config.mode = "development";
- config.optimization.minimize = false;
- config.optimization.minimizer = [];
-
- // https://webpack.js.org/configuration/devtool/
- console.log("config-overrides.js: Set devtool inline SourceMaps");
- config.devtool = "inline-source-map"
-
- // There seem to be a bug in CRA 5 that causes warnings about source maps
- // Disable the warning for now
- // Discussion of the bug: facebook/create-react-app#11767
- // PR supposed to fix the issue: facebook/create-react-app#11752
- console.log("config-overrides.js: Ignoring source map warning facebook/create-react-app#11767");
- config.ignoreWarnings = [/Failed to parse source map/];
-
- return config;
-};
question: How does that work in practice without ? the vite config appear simpler and working?
…________________________________
On project-fixture/scan-sequence.excalidraw<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632873384&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=DmHPZlcSEgxqy0epFm6JtEyaSX3xp2hO-c4A8pk0WzE&e=>:
suggestion: Maybe rename after what should be looked at in this file.
________________________________
On project-fixture/test.excalidraw<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632850026&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=doLsC0Xzu0keMgYx6gAKRaY18oukkncb1nLDsTV8_t0&e=>:
By the way opening that file generates the following error:
This is unrelated to this work, but I'd like to mention it, so at some point it can be picked up.
java.lang.Throwable: test.excalidraw: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/index.html:1]:
Uncaught SyntaxError: Unexpected end of JSON input
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219)
at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:301)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:733)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:733)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:738)
at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:300)
at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354)
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23pullrequestreview-2D3595316794&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=rZ3B8XHnuSTVAQprjs-JEBjhzN8iZKg-clmNETocI-0&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AAFW5LWWDCRMKAENAGIUCZ34CMVUNAVCNFSM6AAAAACO7KGPZSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKOJVGMYTMNZZGQ&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=UhC8MHyagw_eJLbUfDEJC969Yi0Xc0W4ZnDtp2DgNms&e=>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
|
BTW: Happy to take a look at this one:
#488
I'm not sure if a solution exists, but in 18 there may be a way. I’ll noodle on it. Why? I need it myself! LOL
From: Peter Jarvis ***@***.***>
Date: Monday, December 22, 2025 at 12:15
To: bric3/excalidraw-jetbrains-plugin ***@***.***>, bric3/excalidraw-jetbrains-plugin ***@***.***>
Cc: Author ***@***.***>
Subject: Re: [bric3/excalidraw-jetbrains-plugin] feat: upgrade to Excalidraw 0.18.0 with legacy file compatibility (PR #489)
Brice,
As requested, I split the PR into two PR.
You’ll need to merge PR 491 before PR 492. Why? PR #492 requires the Kotlin fix to build, but the fix is now in PR #491. ¯\_(ツ)_/¯
https://github.com/bric3/excalidraw-jetbrains-plugin/actions/runs/20205084307/job/58485047959#annotation:7:290
Have a great Christmas and New Year.
P.
From: Peter Jarvis ***@***.***>
Date: Sunday, December 21, 2025 at 14:48
To: bric3/excalidraw-jetbrains-plugin ***@***.***>, bric3/excalidraw-jetbrains-plugin ***@***.***>
Cc: Author ***@***.***>
Subject: Re: [bric3/excalidraw-jetbrains-plugin] feat: upgrade to Excalidraw 0.18.0 with legacy file compatibility (PR #489)
Brice,
Hey, thanks for the feedback.
Take care and stay safe.
P
From: Brice Dutheil ***@***.***>
Date: Thursday, December 18, 2025 at 14:50
To: bric3/excalidraw-jetbrains-plugin ***@***.***>
Cc: Peter Jarvis ***@***.***>, Author ***@***.***>
Subject: Re: [bric3/excalidraw-jetbrains-plugin] feat: upgrade to Excalidraw 0.18.0 with legacy file compatibility (PR #489)
@bric3 commented on this pull request.
This is awesome !
So many thanks for doing it !
I noticed a few issue though, possibly due to how Excalidraw 0.18 works.
* For example, the plugin used the current IDE theme when opening an Excalidraw file. With this change it doesn't seem to be the case
* Embedded excalidraw in SVG file don't seem to load (hello-export-with-scene.svg)
java.lang.Throwable: hello-export-with-scene.svg: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/assets/index-B5dKs5In.js:40679]:
Error loading file: SyntaxError: Unexpected token '<', "<svg versi"... is not valid JSON
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219)
at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:301)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:733)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:733)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:738)
at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:300)
at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354)
________________________________
In plugin/src/main/kotlin/com/github/bric3/excalidraw/editor/SchemeHandlerFactory.kt<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632810749&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=HLy04YFGZoZhOeYbIaqL8tQxsS1f3GXByTYMs8sFYyU&e=>:
@@ -41,6 +41,17 @@ class SchemeHandlerFactory(val getStream: (uri: URI) -> InputStream?) : CefSchem
uri.path.endsWith(".css") -> response.mimeType = "text/css"
uri.path.endsWith(".svg") -> response.mimeType = "image/svg+xml"
uri.path.endsWith(".png") -> response.mimeType = "image/png"
+ uri.path.endsWith(".jpg") || uri.path.endsWith(".jpeg") -> response.mimeType = "image/jpeg"
+ uri.path.endsWith(".gif") -> response.mimeType = "image/gif"
+ uri.path.endsWith(".webp") -> response.mimeType = "image/webp"
+ // Font MIME types for Excalidraw 0.18.0 self-hosted fonts
+ uri.path.endsWith(".woff") -> response.mimeType = "font/woff"
+ uri.path.endsWith(".woff2") -> response.mimeType = "font/woff2"
+ uri.path.endsWith(".ttf") -> response.mimeType = "font/ttf"
+ uri.path.endsWith(".otf") -> response.mimeType = "font/otf"
+ uri.path.endsWith(".eot") -> response.mimeType = "application/vnd.ms-fontobject"
+ // JSON for any config files
+ uri.path.endsWith(".json") -> response.mimeType = "application/json"
thought: In a future work this might be a good idea to extract the mapping to some configuration file.
________________________________
In plugin/src/main/kotlin/com/github/bric3/excalidraw/utils.kt<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632823182&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=SUL9wYP9NQZ7bi1STpxOz9fIGqTwtHMoGDa3vGw0Gy4&e=>:
@@ -19,9 +19,7 @@ import java.util.function.Supplier
private val logger = Logger.getInstance("com.github.bric3.excalidraw.utils")
-val debugMode = ProcessHandle.current().info().arguments().map {
- it.any { arg -> arg.contains("-agentlib:jdwp") }
-}.orElse(false)!!
+val debugMode = false
chore: To revert, ideally I'd like to keep this.
________________________________
In plugin/src/main/kotlin/com/github/bric3/excalidraw/utils.kt<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632824651&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=bCB-aRsUvfyLYFdZFoA6Cmd1dzgrZ7TY22EvHZZ1JlQ&e=>:
@@ -109,8 +107,11 @@ suspend fun writePayloadToDocument(
* instead of regular `excalidraw.com`.
*
* excalidraw/excalidraw#7543
+ *
+ * Updated for Excalidraw 0.18.0 where font paths changed from
+ * dist/excalidraw-assets/ to fonts/
nitpick:
⬇️ Suggested change
- * dist/excalidraw-assets/ to fonts/
+ * `dist/excalidraw-assets/` to `fonts/`
________________________________
On project-fixture/test.excalidraw<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632829264&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=kL1wLRbjSuFkSJztpqqMsxThiCAPD2IgFJCuHj46LeM&e=>:
chore: Rename test.excalidrow to zero-bytes.excalidraw.
________________________________
In .gitignore<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632832696&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=ebOPLIE6QZjzBij-Yr3mn7GWOxEPh1vNOJxDmd_L92s&e=>:
\ No newline at end of file
+./project-fixture/.idea/workspace.xml
+
+# Claude Code
+CLAUDE.md
suggestion: If claude helped there, maybe that's worth havng that file here. However I'd rather have a standard AGENTS.md file and tell claude to point to it.
________________________________
In excalidraw-assets/build.gradle.kts<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632836435&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=PoT9CDxRXI1TAvWX8PDX3VHR2zUsX5xxeaLN5my7Y1U&e=>:
verboseModeEnabled.set(true)
}
val port = providers.provider {
- // PORT might be is in package.json "/scripts/start" value
- // dumb solution to extract the port if possible
- val defaultPort = 3000
- file("package.json").useLines { lines ->
- val startScriptRegex = Regex("\"start\"\\s?:\\s?\"[^\"]+\"")
- lines
- .filter { startScriptRegex.containsMatchIn(it) }
- .map { Regex("\".*PORT=(\\d+).*\"").find(it)?.groups?.get(1)?.value }
- .map { it?.toInt() }
- .first() ?: defaultPort
- }
+ // PORT is configured in vite.config.ts, defaulting to 3006
+ 3006
note: For future work maybe this can be extracted from the vite.config.ts file, or some other file that both vite and gradle can read.
________________________________
In excalidraw-assets/config-overrides.js<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632871137&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=49FA1Wmp0R_T9ZY25Y8BFTJBRg4vxmbKakv61pkQ5wA&e=>:
-module.exports = function override(config, env) {
- // see https://webpack.js.org/configuration/
- console.log("config-overrides.js: Disabling build minimizer");
- config.mode = "development";
- config.optimization.minimize = false;
- config.optimization.minimizer = [];
-
- // https://webpack.js.org/configuration/devtool/
- console.log("config-overrides.js: Set devtool inline SourceMaps");
- config.devtool = "inline-source-map"
-
- // There seem to be a bug in CRA 5 that causes warnings about source maps
- // Disable the warning for now
- // Discussion of the bug: facebook/create-react-app#11767
- // PR supposed to fix the issue: facebook/create-react-app#11752
- console.log("config-overrides.js: Ignoring source map warning facebook/create-react-app#11767");
- config.ignoreWarnings = [/Failed to parse source map/];
-
- return config;
-};
question: How does that work in practice without ? the vite config appear simpler and working?
…________________________________
On project-fixture/scan-sequence.excalidraw<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632873384&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=DmHPZlcSEgxqy0epFm6JtEyaSX3xp2hO-c4A8pk0WzE&e=>:
suggestion: Maybe rename after what should be looked at in this file.
________________________________
On project-fixture/test.excalidraw<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23discussion-5Fr2632850026&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=doLsC0Xzu0keMgYx6gAKRaY18oukkncb1nLDsTV8_t0&e=>:
By the way opening that file generates the following error:
This is unrelated to this work, but I'd like to mention it, so at some point it can be picked up.
java.lang.Throwable: test.excalidraw: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/index.html:1]:
Uncaught SyntaxError: Unexpected end of JSON input
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219)
at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:301)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:733)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:733)
at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:738)
at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:300)
at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354)
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bric3_excalidraw-2Djetbrains-2Dplugin_pull_489-23pullrequestreview-2D3595316794&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=rZ3B8XHnuSTVAQprjs-JEBjhzN8iZKg-clmNETocI-0&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AAFW5LWWDCRMKAENAGIUCZ34CMVUNAVCNFSM6AAAAACO7KGPZSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKOJVGMYTMNZZGQ&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=CTYMR8YetIlod5We5F_ldHPLghW1qX4a8QFSqCPqbZRitUfaGLcLcm0l80SwZhqs&m=fIBUz0lKjwwM8Q-Q-HfSKPkZS-0dWaq6nJrXNqRl84IKeaiHdrCVVN7yHxOxFH8w&s=UhC8MHyagw_eJLbUfDEJC969Yi0Xc0W4ZnDtp2DgNms&e=>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Yeah go ahead! That said I cannot review seriously until next week. So don't expect much feedback until then. Team care. Also, you should avoid reply by email it seems to leak quite a few like your phone number. |
Summary
Closes #423
This PR upgrades the embedded Excalidraw library from 0.17.x to 0.18.0, bringing the latest features and improvements while maintaining full backward compatibility with existing
.excalidrawfiles.Motivation
Excalidraw 0.18.0 includes significant improvements including new fonts, better rendering, and various bug fixes. However, the upgrade introduced breaking changes in the element data format that caused issues with files created in older versions.
Changes
Build System Migration (addresses CRA incompatibility from #423)
moduleResolution: "bundler")index.htmlto project root (Vite convention)config-overrides.jswithvite.config.ts"type": "module"in package.json for ESM supportExcalidraw 0.18.0 Compatibility
@excalidraw/excalidrawto 0.18.0@excalidraw/excalidraw/index.css)window.EXCALIDRAW_ASSET_PATH = "/"for proper font loading (self-hosted fonts)Legacy File Support
Implemented preprocessing for files created with older Excalidraw versions to fix:
lineHeightautoResizetrueboundElements: null[]frameIdnullfocus/gap)mode/fixedPoint)Loading Strategy
loadFromBlobAPI instead of directupdateScenecallsOther Changes
.woff2font files inSchemeHandlerFactoryChecklist from #423
"type": "module")moduleResolutionupdated to"bundler"excalidraw-assetsfolder handling (now usingfonts/path)EXCALIDRAW_ASSET_PATHupdateSceneAPI changes handledTesting
.excalidraw,.excalidraw.svg,.excalidraw.pngBreaking Changes
None for end users. Existing files continue to work without modification.