Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to limit the content editor webpart, like you can with pagelayout rich text fields. For example I want to limit the use of inline styles, fonts, colors etc. Are there any alternatives to the content editor webpart, which can accomplish this?

Additional info: The webpart is to be used on a publishing page and I do not want to limit the functionality of the publishing fields.

share|improve this question
add comment

2 Answers

Have you tried simply to hide corresponding buttons using ribbon customizations?

Update:

Sample code:

<CustomAction
 Id="RemoveButtons"
 Location="CommandUI.Ribbon">
  <CommandUIExtension>
    <CommandUIDefinitions>
      <CommandUIDefinition Location="Ribbon.EditingTools.CPEditTab.Styles" />
      <CommandUIDefinition Location="Ribbon.EditingTools.CPEditTab.Font.Fonts" />
    </CommandUIDefinitions>
  </CommandUIExtension>
</CustomAction>

And here is what i've got after deployment:

after customizations applied

You should also specify RegistrationType="ContentType" and RegistrationId="your-ContentTypeId-Here" attributes in CustomAction element, if you want to apply this only for pages of your content type.

This should also work for sanboxed solutions.

share|improve this answer
    
No, but I do not want to hide it always. Just for content editor webpart. –  HaavardMeling May 10 '11 at 11:14
    
Hmm... Do you have fixed number of pages, where the content editor webpart functionality must be cutted, or users could add a content editor to some new pages? And also, what kind of pages do you use? Webpart pages? Wiki pages? –  Andrey Markeev May 10 '11 at 12:38
    
It is a publishing page with webparts. –  HaavardMeling May 10 '11 at 12:55
    
Ok, so what you can try to do is to create a document content type, based on WebPart page, and then create a custom action for hiding the ribbon buttons you don't need to be shown, and bind this custom action to your new content type. –  Andrey Markeev May 10 '11 at 13:25
    
I've updated my answer with sample code. Please, try this. –  Andrey Markeev May 10 '11 at 13:34
show 3 more comments
up vote 0 down vote accepted

Basically what I ended up doing was to use the InputFormTextBox() like shown here: http://karinebosch.wordpress.com/sharepoint-controls/inputformtextbox-control/

I used this technique and put it into a custom EditorPart for the webpart. The content is stored in a property of the webpart and edited in the webpart property pane.

Simple User Interface for Text Web part

share|improve this answer
add comment

Your Answer

 
discard

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.