GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

[BUG] SVG is not visible in editor #2822

Closed Lighost closed 4 years ago

Lighost commented 4 years ago

Hello, I have needed to put svg into my project so I used custom code component for this purpose. But when I copy svg content into component it shows nothing. But when I look at generated index the svg is visible. I have tried same thing in demo editor, but there it is not visible in editor and also at preview mode. I have tested it with latest Safari and latest version of Google Chrome and of course I am using latest version of GrapesJS (0.16.12).

Source of wanted svg is HERE

How it looks in editor:

How it looks in index.html (in my page)

Firstly I thought mistake might be with my svg, but then it wouldn't be visible in index. Any idea what's wrong?

RJCAM commented 4 years ago

Hello @Lighost I think the issue is with that svg because this is the only that isn't working properly. This can have some code that are not being understood properly by the Custom Block itself. One solution is to save the svg locally and drop it using the default Image Block of the editor, I have tested it and it works. Also I have tested the same issue with lot's of different svg's and they are working fine.

Lighost commented 4 years ago

@RJCAM Yes I know, I have already did this, like inserted SVG as img. But in my case I really need insert it as svg object – because I have to do some hover effects with fill attribute. In any case, somehow it has started be visible in editor. I don't know what I have done, because I just like 3 times changed svg class filling, and now they are visible at editor. So for me, im closing this issue, because it's solved 😄 .