From a technical point of view, if it has something that makes up one visible new line in it, as you showed in your question, this is not entirely "empty".
Actually, you need to analyze the meaning of the content in order to find out if there is content that is not inside the tags, nor a few special characters, such as etc.
I try to do this in js, if necessary, taking the entire line of text and breaking it into an array based on "<" then taking each element of the array and deleting the text to the left of ">", then trim. This leaves me with an array of either blank lines or text that is outside of any tags. From there itโs easy enough to check if there are any rows in the array, if they are not empty, and not "".
It may be more cumbersome than some parsers that I donโt know, but it is quite reliable and fast. (and a very similar method can be used in the language of the formula).
In the ssjs formula you can:
var checkString = @trim(@replacesubstring(@implode( @trim (@right( @explode( sourceHTMLstring , "<" ) , ">" ) ) , " "), " " , "")); if(checkstring == "") {
Obviously, this can be done just as easily in pure javascript, but the old formula language is so ingrained in my head that I would go that way out of habit.
** Also note: you can check the <img> tag there somewhere if someone has done absolutely nothing but put the image in rich text.
source share