Contenteditable tag continuation

Viewed 161

Small intro to what's happening before the question:

When typing text in a contenteditable that contains html tags, it continues inserting within the tag if you are to the right of the tag. For instance, if I have text like this:

The <b>quick</b> fox jumped over the lazy dog.

and it renders like this

The quick| fox jumped over the lazy dog.

My cursor is located at the pipe position, directly after the word quick. If I enter in brown I will get

The <b>quick brown</b> fox jumped over the lazy dog. 

The quick brown| fox jumped over the lazy dog.

example: http://jsfiddle.net/mBzvs/

My question is, how do I remove this tag-continuation feature for other tags such as span? I'd like to keep it for the <b> tag but I don't want this to happen for the <span> tag.

2 Answers
Related