Enable PowerPaste to Sitecore Rich Text Editor

In this blog post I will show how you can change Rich Text to behave similar like the TinyMCE PowerPaste plugin.

Changing the behaviour of paste 

When an editor is pasting text in the rich text editor, we can control how much formatting is removed.
In this example I have set the Paste to remove everything except newlines.
This setup could help content editors to easier move text from work documents(or other 3rd party tools) over to Sitecore without needing to use one of the paste buttons.

Changes needed to apply "Power Paste"

In the file:~/sitecore/shell/Controls/Rich Text Editor/EditorPage.aspx there is an EditorUpdatePanel with the setting StripFormattingOptions and StripFormattingOnPaste.
The original values are set to "MSWordRemoveAll,ConvertWordLists".
If we change this to
StripFormattingOptions="AllExceptNewLines"
StripFormattingOnPaste="AllExceptNewLines"
we would have the "Power Paste" activated.

Other options to consider if you want to strip less or more

  • NoneSupressCleanMessage: Doesn't strip anything on paste and does not prompt user whether MS formatting should be cleaned.
  • None: If no MS Word formatting is detected, content is pasted as is. If MS Word formatting exists, user is prompted to clean it.
  • MSWord: strips Word-specific tags, preserving fonts and text sizes.
  • MSWordNoMargins: strips Word-specific tags and margins, preserving fonts and text sizes.
  • MSWordNoFonts: strips Word-specific tags, preserving text sizes.
  • MSWordRemoveAll: strips Word-specific tags, fonts and text sizes.
  • Css: strips CSS styles.
  • Font: strips Font tags.
  • Span: strips Span tags.
  • ConvertWordLists: converts Word ordered/unordered lists to HTML tags.
  • AllExceptNewLines: Clears all tags except "<br />" and new lines (\n).
  • All: strips all HTML formatting and pastes plain text.


Comments

Unknown said…
Awesome tutorial. You have explained everything very clearly. It is really surprising to convert a normal Rich Text and behave it similar to the TinyMCE PowerPaste plugin.
I always use TinyMCE for website content creation because it supports various plugins and has a wide range of useful features. For Copy/paste task I prefer PasteitCleaned because it is completely similar to PowerPaste plugin but has much less monthly cost.
manish said…
This comment has been removed by a blog administrator.

Popular posts from this blog

Step by step guide to add Glass Mapper to Helix solution

Using interfaces with Glass Mapper

Adding dynamic image source for multi-site solutions with $site$ token and setting dynamic datasource location for components