New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Style tag appears on paste from MS Word in Firefox on a Mac


Product RadEditor for ASP.NET AJAX


An unwanted style tag appears on paste from MS Word in Firefox on a Mac when StripFormattingOptions is set to MSWordRemoveAll and Css


We have a strange issue where when we copy and paste from Word to the Telerik Editor using Firefox on a Mac that the editor inserts a large <style> tag with a font face element inside.


The solution is to perform fine filtering of the clipboard content and stripping based on a regular expression prior to pasting the content in RadEditor:

    <script type="text/javascript">
        function OnClientPasteHtml(sender, args) {
            var commandName = args.get_commandName();
            var value = args.get_value();

            if (commandName == "Paste") {
                value = value.replace(/<style((.|\\n|\\r)*?)<\/style>/gi, ""); //strip the style tag with a regular expression
                args.set_value(value);  //set the modified content in the editor
    <telerik:RadEditor runat="server" StripFormattingOptions="MSWordRemoveAll,Css" OnClientPasteHtml="OnClientPasteHtml">
In this article