[Please describe in as much detail as possible how we can replicate this bug]
Soo, not sure if intentional or not but when copy/pasting via the clipboard, the code element wipes out some of the content. I’m seeing this mostly with SVG’s (font awesome svg’s as well as custom ones), when pasting an element that has these the svg code that lives in a HTML block goes away…
Might there be a workaround to keep it?
Here is how I’m using it:
Create section I want to re-use in the future.
Save section.
Copy section to clipboard.
Paste clipboard content into custom field
Link custom field to button
Copy custom field content using clipboard.js
Paste content onto new page
Everything comes across correctly except for the SVG code.
I am using ACF, I’ve tried both setting myself as an unfiltered user as well as adding the SVG exception but am not having much luck with either. I’ve attached a screenshot of my functions file below.
You’re 100% correct that it works fine when copy/pasting from VS code.
Also conscious that this probably goes beyond normal bricks support, but really do appreciate your help @timmse <3
Quick update:
I don’t think it’s the ACF field that’s causing the error. It looks like the content there is being saved correctly, just what is being copied to clipboard through the clipboard.js script is sanitized.
Not sure if this is what bricks is pushing via the custom field or something built into clipboard.js
The content is being pulled through an acf text field and then embedded as an attribute on a button (image attached below). When I then look at that content on the front-end (via inspecting the button and seeing the attribute-data, that data is once again missing the SVG code.
Unfortunately this is about where my development skills end, and am getting into new territory, might the attribute data be changed in any way by bricks?
Ignore what I wrote above. This is definitely an ACF/wordpress thing. If the code is just pasted into bricks it outputs fine.
Going back to try and figure out how to allow this type of content through wordpress/acf. If you have any other ideas they are more than welcomes! Will post a solution here if/when I find one.
It disables code from rendering, but ive now just discovered that its no longer supported… sad.
Oh well will have to be a temporary solution and bring someone onboard to code something that can copy to clipboard without rendering it (assuming its possible, unfortunately it’s beyond my dev skills). Its been replaced by the "<“pre”> and <“code”> elements in html5 but they dont support “<” characters which is preventing me from using them.