Skip to content

Commit 04f1c8b

Browse files
authored
Merge pull request #459 from FromDoppler/doi-2125-big-box-problema-imagen
Big Box problema con imagenes
2 parents 959f1c9 + f859308 commit 04f1c8b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Doppler.HtmlEditorApi/Domain/DopplerHtmlDocument.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,16 @@ public void SanitizeTrackableLinks()
9797
public void SanitizeDynamicContentNodes()
9898
{
9999
var dynamicContentNodes = _contentNode.SelectNodes("//dynamiccontent");
100+
100101
if (dynamicContentNodes != null)
101102
{
103+
var substringsToMatch = new[]
104+
{
105+
"unlayer-editor",
106+
// cspell:disable-next-line
107+
"cdn.fromdoppler.com"
108+
};
109+
102110
for (var i = 0; i < dynamicContentNodes.Count; i++)
103111
{
104112
var divNodes = dynamicContentNodes[i].SelectNodes("div");
@@ -110,9 +118,15 @@ public void SanitizeDynamicContentNodes()
110118
}
111119
}
112120
var imgNode = dynamicContentNodes[i].SelectSingleNode(".//img");
113-
if (imgNode != null && imgNode.GetAttributeValue("data-dc-type", null) == null)
121+
122+
if (imgNode != null)
114123
{
115-
imgNode.SetAttributeValue("src", "[[[DC:IMAGE]]]");
124+
var srcValue = imgNode.GetAttributeValue("src", "");
125+
126+
if (substringsToMatch.Any(sub => srcValue.Contains(sub)))
127+
{
128+
imgNode.SetAttributeValue("src", "[[[DC:IMAGE]]]");
129+
}
116130
}
117131
}
118132
}

0 commit comments

Comments
 (0)