SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 )

share|improve this question
up vote 0 down vote accepted

To close this question: I was unable to retain these attributes.

I ended up using a button in RTE (insert Foo), which opens a selection of Foos and then adds a hyperlink with a specific class and an href url pointing to a list-item in the Foo's list.

The rest I did using JavaScript (update content on page-load, etc.)

All information I needed is now stored in a css class and the href. The contenteditable attribute is still missing (but would be nice to have...)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.