More on Umbraco, TinyMCE and Flash

by Aaron Powell 3. February 2010 10:05

In a previous post Shannon explained how to customise TinyMCE for what HTML elements Flash actually supports, and he finished off the post with showing how to cleanup line breaks.

To do this he used an XSLT function called normalize-space, which is great if you’re using XSLT!

I was writing a service today which was using LINQ to XML to generate the XML for Flash, but that posed a problem, how do you deal with Flash wanting to do hard breaks on new line constants?

Easy, string.Replace to the rescue!

Here’s a handy little extension method you can drop into your code libraries:

public static string NormalizeSpace(this string s) {
	if(s == null) throw new ArgumentNullException("s");
	return s.Replace("\r\n", string.Empty)
		.Replace("\r", string.Empty)
		.Replace("\n", string.Empty);
}

Nice and easy (and unsurprisingly logical!).

Categories: .Net | Flash | Umbraco

Comments

9/23/2010 8:07:15 AM #

I'm really happy with Umbraco  as a blogging tool since I got livewriter support hooked up writing a blog post is now an extremely quick process and I don't need to worry about anything expect the content of the post.

Yesterday I was sat thinking about what tools would improve the quality of my posts and came up with a couple of ideas for Umbraco packages that I would like to see. As time is limited and I'm not sure I'll have the time to build these packages I thought I'd outline my ideas here and possibly inspire someone else to pick up the ideas and run with them.

The first idea is the more simple of the two. I'd like that when I publish a blog post that certain keywords are automatically linked to URLs. For example the word Umbraco always gets linked to umbraco.org or the phrase Liverpool gets linked to the official Liverpool website. These words and phrases would need to be setup in a configuration file.

wow account for sale India