
The object passed into here, is pure TinyMCE config only.

If you only want to apply it to certain parts then read on.ĮditorInitConfigurationOptions: Seen on Line5, this is the attribute that allows you to configure the editor. If it's set to false, Episerver will try to find a file within the webroot instead.ĪlwaysEnabled: Seen on Line3, if true, the config will be enabled for the whole of Episerver. ServerSideOnly mode means the config is defined in C# code. ServerSideOnly: Seen on Line 4, this needs to be true, otherwise, you'll get a JavaScript error when the editor loads. The important parts of the code above include: When you want to customise TinyMCE within Episerver, instead of messing about with a config file we can do it in code, using the TinyMCEPluginNonVisual attribute! To get started, create a regular empty class within Visual Studio and apply the TinyMCEPluginNonVisual attribute onto it, like so: When you upgraded Episerver you will loose your custom changes. If you tried to customise any core file, you'd break your Episerver upgrade path. Episerver is installed via Nuget and the TinyMCE config file is also installed this way. When it comes to customizing TinyMCE with Episerver though, it's not as easy as simply updating a config file within your webroot. If you want to customise how the Episerver editor works when copying and pasting content from MsWord within the TinyMCE editor, you will more likely find a useful answer by Googling for the term TinyMCE rather than Episerver editor. TinyMCE is a very widely adopted online text editor.

Within the CMS the WYSIWYG editor that is associated with this property is called TinyMCE. When working with rich content in Episerver you will be working with the XHTML property. Configuring TinyMCE To Enforce Paste As Plain Text Globally If you want to learn how to do this, read on. How do you solve this issue? A better solution is to configure Episerver to strip out all the extra crap and only allow a 'text-only' copy and paste. The content editors are the people who'll actually be using the product day-in and day-out, so it's unfair to make their lives difficult, just to ensure they don't make any mistakes. These hidden tags can break your responsive designs, it can make your content look funny and it can even make your pages load longer.Ĭreating some proclamation that content editors who use your Episerver powered website can not use Microsoft Word is unrealistic. In a word document where page load times are not important, this might be acceptable, however, on a website this is pants. When content is copied into Episerver like this, a number of hidden metadata tags and other crap will also be copied as well. When they are happy with their prose, they will then copy the content directly into an Episerver ContentArea. For speed and ease of creation, a lot of editors will create the initial draft within a program like MSWord or LibreOffice. Who can fault anyone who has lots to do and not enough time to do it in. When it comes to publishing content within an Episerver powered website, content editors will usually want to get on with a task as efficiently as possible. * Optional: Remove the html path code from the status bar.Life is busy. * Optional: Adjust the positioning of the character count text. Init_instance_callback: function (editor) "].plugins.getCount() <= 5000 Toolbar: "bold italic | link | bullist numlist ",

The last piece was to validate the character count in the “on submit” event.I also added a generic “Over 5000 characters” validation message that I turn on and off based on the validation done in the “on change” event.I used this Stack Overflow answer to hide the the path in the status bar of the editor.I layered on this Stack Overflow answer to decode the raw HTML in a way that gave me the most accurate character count.I started the plugin with a generic base similar to the existing TinyMCE word count plugin.This version is the closest I could get to the Microsoft Word character counts. I tried many different ways of pulling and counting the visible characters but many of them were pretty inaccurate. It ended up pretty straight forward in the end. To do this I created a character count plugin. We only need to count the actual characters that the user sees, all html and hidden characters are ignored. This count is purely to keep the users from writing a book each time they enter data. We have a requirement that limits the users to 5000 characters per textarea field. TinyMCE has a built in word counter but it does not have a way to count characters.
