sachatrauwaen / OpenContent

Structured Content editing for DNN (Dotnetnuke)
46 stars 25 forks source link

convertHtmlToText causes error in DNN 9.8 #157

Closed Timo-Breumelhof closed 3 years ago

Timo-Breumelhof commented 3 years ago

{{convertHtmlToText (truncateWords Text 250)}}

leads to this error in DNN 9.8.0:

Template error
Failed to render Handlebar template D:\Websites\DNN9Dev.local\Files\Portals\Observant2021\skins\observant4\OpenContent\Templates\03-Articles\latest.hbs
Method not found: 'System.String DotNetNuke.Services.Mail.Mail.ConvertToText(System.String)'.

https://github.com/sachatrauwaen/OpenContent/blob/a3dadd8cc7414ad622ff6bc3e0f0cd9aed41ae3a/OpenContent/Components/Handlebars/HandlebarsEngine.cs#L1053

I guess this was introduced by the introduction of the email provider?

Timo-Breumelhof commented 3 years ago

Ok, this is caused by removal of the method in DNN which has been re-added here: https://github.com/dnnsoftware/Dnn.Platform/commit/2e19fbff8c163796bd44a3253b4639de12cfc43f#diff-e16ba089399e7b57b56084598a4eddb21d324c15872728be0bf189b6bfaf5754

Timo-Breumelhof commented 3 years ago

Wait for that or replace the function with the more low level (what "convertHtmlToText" does too)


            var formattedHtml = HtmlUtils.FormatText(sHTML, true);
            var styleLessHtml = HtmlUtils.RemoveInlineStyle(formattedHtml);
            return HtmlUtils.StripTags(styleLessHtml, true);

The issue in DNN seems to be fixed in DNN 9.9.0

Timo-Breumelhof commented 3 years ago

Fixed in 04.06.00