I recently added a live comment preview box to the comment page on my blog. While it sure is pretty, it didn’t really do much as Community Server doesn’t support markup in comments out of the box. The fix to enable this is easy enough: In CommunityServer.Components.Formatter, there is a static method called SafeFeedBack. In this method, a call is made to Globals.HtmlEncode, which is just a wrapper around Web.HttpUtility.HtmlEncode (which of course strips out all markup from a string). Comment this out, and add a call to HtmlScrubber.Clean(text, false, true) right above the block that replaces linebreaks with break tags. The 3rd boolean parameter tells CS to still strip out script tags, so this should be safe to use. If any of the Telligenti have a compelling argument as to why this wouldn’t be safe, feel free to share.
So now not only do I have the purdy live comment preview, it actually works as well. As Phil stated, the next step is to automate this a little more…I’ll knock that out within the next couple of days. In the meantime, knock yourselves out with markup in your comments on JK.com.
Posted
Mar 14 2006, 06:37 PM
by
Jayson Knight