Recently I was working on project built with Sitecore 8.1 update 1, and I faced issue with Rich text editor prevent me from create HTML content with background image :
- Add HTML that contains div with background image using " HTML editor ":
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section id="interior-top-photo-new" class="flex-display" style="height: 400px;background-image:url('-/media/04DAD0FDDB664070881F17264CA257E1.ashx');" > | |
<div class="container"> | |
<div class="row"> | |
<div class="col-xs-12"> </div> | |
</div> | |
</div> | |
</section> |
- Then switch to " Show editor " or try to edit anything, the background automatically trimmed from content into this :
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section id="interior-top-photo-new" class="flex-display" style="height: 400px;"> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-xs-12"> </div> | |
</div> | |
</div> | |
</section> |
However, I tried to add url link to the background image, but I had the same issue. So I contacted the Sitecore support, and they provided a solution and .dlls fix, also this issue has registered as a bug with reference number 145733 in Sitecore.
Solution:
Sitecore uses a third party component from Telerik for its rich text editor, and using a more recent version of Telerik libraries helps to solve the issue.
- Download dll files [ Telerik.Web.UI.zip ] and [ Telerik.Web.UI.Skins.zip] from link https://goo.gl/8tvb5N
- Extract .dll files and copy into your /bin folder, replacing the old assemblies;
- Edit your web.config files in the following way:
....
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" />
<bindingRedirect oldVersion="2015.1.401.45" newVersion="2017.1.118.45" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Lucene.Net" publicKeyToken="85089178b9ac3181" />
<bindingRedirect oldVersion="0.0.0.0-2.9.4.0" newVersion="3.0.3.0" />
</dependentAssembly>
....
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" />
<bindingRedirect oldVersion="2015.1.401.45" newVersion="2017.1.118.45" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Lucene.Net" publicKeyToken="85089178b9ac3181" />
<bindingRedirect oldVersion="0.0.0.0-2.9.4.0" newVersion="3.0.3.0" />
</dependentAssembly>
....
I hope that was helpful for you ! please do not hasitate to comments or contact me if you have any question. 🌺
Baraa Masri
Email: Bmasri@tanasuk.com
Twitter: @Bara_Masri