0

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 )

1 Answer 1

0

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...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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