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

My goal is to create a rich text editor for a textarea in my custom webpart in SharePoint 2013. The data is saved outside the SharePoint, so I can't really use a sharepoint list for that.

I really like the way rich text editors work in SharePoint 2013 when you edit list items with enhanced rich text fields:

rich text editor with ribbon while editing a list item

When I use a built-in RTE control in my markup SharePoint:InputFormTextBox:

<SharePoint:InputFormTextBox ID="rftDefaultValue" 
    RichText="true" 
    RichTextMode="FullHtml" runat="server" 
    TextMode="MultiLine" Rows="5">
</SharePoint:InputFormTextBox>

It gives just an inline RTE in IE or nothing in Chrome:

Inline Rich Text Editor in IE and Chrome

The question is:

Could it be possible to use the cross browser ribbon based Rich Text Editor in custom webpart textareas?

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

You might also want to try this little jQuery plugin

It allows you to enable Ribbon WYSIWYG editor while you are in edit mode.

It works simply like this: $("#myDiv").SPEditable();

And the result might look like this:

And this is a real life example where this can be really useful:

Update: Now this plugin supports SP 2013:

share|improve this answer
    
Thanks for the tip! I'll try it out.. –  Anatoly Mironov Jun 14 '13 at 19:50
add comment

Yes it is possible, check this tutorial out that is demonstrating how to create a Visual WebPart as a Text editor and it's also connected to Ribbon as claimed by author, however it's for SharePoint 2010 but I am pretty sure it will work as it is or with some changes for SharePoint 2013 as well.

Develop a custom editable Visual Web Part (WebPart)

Helpful Links

http://stackoverflow.com/questions/15668474/webpart-with-custom-editorpart-does-not-save-data

http://stackoverflow.com/questions/3614989/how-can-i-extend-the-ootb-content-editor-web-part-in-sharepoint-2010

http://stackoverflow.com/questions/3771519/develop-a-custom-editable-visual-web-part-webpart-for-sharepoint-2010/3786142#

Edit

Blog Post is too lomg to add here but description is here,

I wanted to create a web part for Sharepoint 2010 that would let an editor add a block of free-form html to a page, but wrapped up in a nicely formatted HTML container of my choosing. I also wanted the web part to include some custom properties to allow the user to select some permutations for the HTML container (colour, position etc.). The key thing was that when the editor is amending the content, I wanted to be able to use the standard ribbon controls instead of having to hook in a 3rd party rich text control like Telerik RadEditor.

So, I assumed I could just take the build-in Content Editor Web Part (CEWP) and extend it. No dice - cos it's sealed!

So I ended up whipping out Reflector and digging into the CEWP code, ripping the guts out of it to hack a new webpart. The following Web Part does what I set out to do, and maybe it will be a good base for you too.

share|improve this answer
    
Thank you @Muhammad, I will absolutely try this solution. Could you describe the solution a little bit in your answer so that one knows what the answer is even if the link gets broken in the future? –  Anatoly Mironov Apr 3 '13 at 8:12
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.