- This topic has 5 replies, 3 voices, and was last updated 3 years, 7 months ago by Alexander.
-
AuthorPosts
-
September 25, 2020 at 3:35 am #1458229Alexander
Hello GP-Team,
I am using Generatepress 3.0 beta2 and the latest GP Premium RC with Generateblocks on a site that I am currently working on.
Previously I was using an SVG sprite sheet for a handful of icons that are being used throughout the site like so:<svg class="mysvgicon"> <use xlink:href="/wp-content/themes/mytheme/svg/si-sprite.svg#si-entypo-brush"></use></svg>
Now I am trying to do the same with the icon option in Generateblocks but my code seems to fall victim to sanitization.
What would be a good way of getting this to work?
Also, do you recommend using the Generateblocks Headline block for paragraphs over the default WordPress paragraphs?Thanks in advance!
September 25, 2020 at 5:25 am #1458339DavidStaffCustomer SupportHi there,
The GB Icon field will only accept an inline SVG – you cannot use xlink:href at this time. That maybe something we review in the future but that method doesn’t have the best browser support….
Paragraphs – no we recommend you use a Paragraph block. Reserve using the Headline Block when you need to create a different styled element to those the Customizer body/heading typography provides.
September 25, 2020 at 5:36 am #1458356AlexanderHello David,
that is too bad. It would be great if this could be supported in a future version.
I noticed that xlink is being depreciated and the recommended way of linking is now plain href.
Browser support seems OK with the exception of IE naturally but can be worked around with something like https://github.com/jonathantneal/svg4everybodyI believe that a saw a post by Tom in the past with some code that lets you bypass the sanitization (could not find it again via search now). Since I am the only person that will be working on/having publishing rights on the site, do you think this would be a feasible option?
September 25, 2020 at 7:52 am #1458655DavidStaffCustomer SupportTheres this article which covers the WP sanitization:
https://docs.generateblocks.com/article/fix-svg-icons-not-saving/
Not aware of anything that excludes DomPurify from the code.
Ill pass this on to Tom.September 25, 2020 at 9:35 am #1458825TomLead DeveloperLead DeveloperThere is no way around DOMPurify at this time. Not sure if we’ll work that in, but it’s worth looking to see if we can allow this sort of implementation safely.
September 26, 2020 at 12:54 am #1459513AlexanderThat would be great. I do think that having a cache-able spritesheet does have benefits and support for it seems quite good with some exceptions.
-
AuthorPosts
- You must be logged in to reply to this topic.