bric3 / excalidraw-jetbrains-plugin

Create or edit Excalidraw files within Jetbrains IDEs (IntelliJ, CLion, Webstorm, Goland, ...)
https://plugins.jetbrains.com/plugin/17096-excalidraw-integration/
MIT License
80 stars 11 forks source link

Plugin does not display text #342

Open lordsoffallen opened 2 months ago

lordsoffallen commented 2 months ago

When I save a file from excalidraw, it shows the layout and all correctly but no text is displayed and it's all empty.

Here is an example of what I mean: image

I still see the originalText data in the file but it doesn't appear on my screen.

bric3 commented 2 months ago

Seems like a Excalidraw issue. Could it be the text color ?

Can this file be shared ?

lordsoffallen commented 2 months ago

I can't share the file but i can share a sample if it helps:

{
  "type": "excalidraw",
  "version": 2,
  "source": "https://excalidraw.com",
  "elements": [
    {
      "id": "nA-eXOglCAOwdczJCFeFj",
      "type": "rectangle",
      "x": 10993.502608406277,
      "y": 6886.00528829476,
      "width": 1887.9998779296875,
      "height": 1180,
      "angle": 0,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#e9ecef",
      "fillStyle": "hachure",
      "strokeWidth": 1,
      "strokeStyle": "solid",
      "roughness": 1,
      "opacity": 100,
      "groupIds": [],
      "frameId": null,
      "index": "Zw",
      "roundness": {
        "type": 3
      },
      "seed": 1100795653,
      "version": 86,
      "versionNonce": 799229381,
      "isDeleted": false,
      "boundElements": null,
      "updated": 1727096253487,
      "link": null,
      "locked": false
    },
    {
      "id": "Va8eekcIw5yBC1F5Ut2sB",
      "type": "rectangle",
      "x": 11008.168746101588,
      "y": 5579.3385199028335,
      "width": 3328.0001831054683,
      "height": 1284.000015258789,
      "angle": 0,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#e9ecef",
      "fillStyle": "hachure",
      "strokeWidth": 1,
      "strokeStyle": "solid",
      "roughness": 1,
      "opacity": 100,
      "groupIds": [],
      "frameId": null,
      "index": "Zx",
      "roundness": {
        "type": 3
      },
      "seed": 511236203,
      "version": 170,
      "versionNonce": 1063443403,
      "isDeleted": false,
      "boundElements": [],
      "updated": 1727096251003,
      "link": null,
      "locked": false
    },
    {
      "id": "z-LNFaQ4yiql4-QWkO9LU",
      "type": "rectangle",
      "x": 8247.338350550252,
      "y": 5391.204750149015,
      "width": 2664.000244140625,
      "height": 3464.000244140626,
      "angle": 0,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#e9ecef",
      "fillStyle": "hachure",
      "strokeWidth": 1,
      "strokeStyle": "solid",
      "roughness": 1,
      "opacity": 100,
      "groupIds": [],
      "frameId": null,
      "index": "Zy",
      "roundness": {
        "type": 3
      },
      "seed": 1979697381,
      "version": 104,
      "versionNonce": 2003911589,
      "isDeleted": false,
      "boundElements": [],
      "updated": 1727099438793,
      "link": null,
      "locked": false
    },
    {
      "id": "aWNL7SQ4UT_MO3qaTb45e",
      "type": "rectangle",
      "x": 11176.886207409265,
      "y": 3915.978596282589,
      "width": 1579.999923706055,
      "height": 692.346722692133,
      "angle": 0,
      "strokeColor": "#1971c2",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "strokeStyle": "solid",
      "roughness": 1,
      "opacity": 100,
      "groupIds": [],
      "frameId": null,
      "index": "b2G",
      "roundness": {
        "type": 3
      },
      "seed": 1512192619,
      "version": 378,
      "versionNonce": 1351537771,
      "isDeleted": false,
      "boundElements": [
        {
          "id": "uXaZLNZAYkzNzrDZ810qL",
          "type": "arrow"
        },
        {
          "id": "w8rCsk3gnKLUr5z3Fgjs2",
          "type": "arrow"
        }
      ],
      "updated": 1727093464389,
      "link": null,
      "locked": false
    },
    {
      "id": "Wekw1S_Z5qccB1LnCpJ_c",
      "type": "rectangle",
      "x": 11277.802823551028,
      "y": 4069.584236716396,
      "width": 409.26216624990445,
      "height": 252.9984489691684,
      "angle": 0,
      "strokeColor": "#1971c2",
      "backgroundColor": "#b2f2bb",
      "fillStyle": "hachure",
      "strokeWidth": 2,
      "strokeStyle": "solid",
      "roughness": 1,
      "opacity": 100,
      "groupIds": [],
      "frameId": null,
      "index": "b2H",
      "roundness": {
        "type": 3
      },
      "seed": 1845552779,
      "version": 268,
      "versionNonce": 1991837771,
      "isDeleted": false,
      "boundElements": null,
      "updated": 1727093464389,
      "link": null,
      "locked": false
    },
    {
      "id": "u14mGUwF1f_anGQk0ONHR",
      "type": "text",
      "x": 11875.050311845524,
      "y": 3937.694763839968,
      "width": 107.57644653320312,
      "height": 35,
      "angle": 0,
      "strokeColor": "#1971c2",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "strokeStyle": "solid",
      "roughness": 1,
      "opacity": 100,
      "groupIds": [],
      "frameId": null,
      "index": "b2K",
      "roundness": null,
      "seed": 544661675,
      "version": 229,
      "versionNonce": 2057815787,
      "isDeleted": false,
      "boundElements": null,
      "updated": 1727093464389,
      "link": null,
      "locked": false,
      "text": "PANELS",
      "fontSize": 28,
      "fontFamily": 1,
      "textAlign": "left",
      "verticalAlign": "top",
      "containerId": null,
      "originalText": "PANELS",
      "autoResize": true,
      "lineHeight": 1.25
    },

As you can see text or originalText has a string value but those are not displayed somehow.

bric3 commented 2 months ago

Unfortunately I cannot reproduce with the above truncated snippet.

Hypothesis : this plugin has been released with 0.17.3 (the latest), maybe the website uses an unreleased version that has compatibility issue.

bric3 commented 2 months ago

By comparing the text type element I noticed two keys

diff --git a/project-fixture/hello.excalidraw b/project-fixture/clipboard.excalidraw
--- a/project-fixture/hello.excalidraw
+++ b/project-fixture/clipboard.excalidraw

-       "fillStyle": "hachure",
+       "fillStyle": "solid",

-       "baseline": 18

+       "index": "b2K",

The (+) are the lines seen on your snippet, the (-) lines are the ones seen on files produced by Excalidraw 0.17.3 (used by this plugin).

After some testing it seems your text elements lack the baseline, adding "baseline" : 25 to your text elements (I don't know the correct value, this is something computed by excalidraw) will make the text appear.

lordsoffallen commented 2 months ago

You're right, that works, i just added baseline to one of the elements that has text and somehow they all appear now. Question is why is this missing and would i have to add it manually? :sweat_smile:

bric3 commented 2 months ago

I made a quick search and found this PR that landed after 0.17.3 that deprecates baseline : https://github.com/excalidraw/excalidraw/pull/7693

lordsoffallen commented 2 months ago

Yes, then i think web browser uses master branch, not the latest release which would explain the inconsistency

bric3 commented 2 months ago

I left a comment on this PR. I'm not at ease to use the master branch for this plugin so I'd rather wait for a new release. Unless they changed the way the library should be consumed.

lordsoffallen commented 2 months ago

Yes, understandable. We just wait the next release. Thanks for the help :)

bric3 commented 2 months ago

You're welcome, thanks for reporting and using the plugin :)

bric3 commented 2 weeks ago

It seems Excalidraw v18 is on the way, once this is released I will ship another Excalidraw version which should essentially fix this issue.