Hi guys, this may be in a simular vein to what is being discussed, recently I need to round some corners on selected images on a drag and drop template, it should be as easy as clicking the image and then adding a custom class to said image ![]()
My solution was to add a code word to the alt tag on the image i.e. [round] and then to write some JS code to remove the special word (for good SEO practice) and then inject a custom class. Works perfectly, but it’s a dirty solution ![]()
Please hubspot allow custom classed on standard DND sections.
Here is what I wrote if anyone needs it,
document.addEventListener("DOMContentLoaded", function (event) {
const imgElements = document.querySelectorAll("img");
for (let i = 0; i < imgElements.length; i++) {
let currentImg = imgElements[i];
let altText = imgElements[i].alt;
let titleText = imgElements[i].title;
if (altText.indexOf("[round]") >= 0) {
console.log(altText);
console.log("found image to round");
// step one - remove [round] from alt
currentImg.alt = altText.replace(" [round]", "");
currentImg.alt = altText.replace("[round]", "");
// step two - remove [round] from title
currentImg.title = titleText.replace(" [round]", "");
currentImg.title = titleText.replace("[round]", "");
//add custom class to image for rounded corners
currentImg.classList.add("roundcorner-img");
}
}
});