What I'd love to do:
- In a RichHtmlField of a publishing Page
- click "insert" in the ribbon, then "Foo"
- This let's me select from a list of "Foos"
- and inserts something that is not "contenteditable" but renders like a word or sentence.
My Idea:
- Add a button to the ribbon
- on click of that button add a span with
class="FOO" contenteditable="false" fragmentid="/Foo/0"
attributes to the RTE - have javascript do some stuff to the span (find it using the class, update the content using the fragmentid)
Now here's the problem:
When I save the publishing page, the "custom attributes" contenteditable & fragmentid vanish from the source.
How can I make the RTE keep the custom attributes?
Or is there a better way to do this? (I.e. by creating a UserControl? But how would I insert this using the RTE?)
(Originally I wanted to use WebParts for this, but it seems I can not make them render "nicely", see Create a WebPart that floats in text )