This is a migrated thread and some comments may be shown as answers.

Paste problems with MS Word 2003 and Firefox 3.0.3

3 Answers 83 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Matej
Top achievements
Rank 1
Matej asked on 12 Dec 2008, 09:50 AM
Hi,

I've read some threads concering paste issues with RadEditor control.
Unfortunately i haven't found solution to my issue. 
The problem arises when pasting the text from MS Word to RadEditor (in Mozilla Firefox 3.0.).
RadEditor is wrapped in the DetailsView and when i click the upload link the content is saved in the
database. When previewing the content in the Literal control (in IE 7) strange syntax is displayed:
<!--[if !supportLists]-->­       <!--[endif]-->

The problem is that IE doesnt recognize this as a comment (because of <!--[ instead of <!--) and
displays is as the text in the website. To make things clearer: The problem is that FF puts some 
additional html comments when pasting content from MS WORD. IE does not recognize that as 
a comment and displays it.

Things work just fine If i try the other way around (paste text from MS WORD in IE and preview it in FF).
Could someone help me with this issuse as it is annoying.

thx 

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 16 Dec 2008, 02:00 PM
Hi Borut,

Could you please, see the following forum thread on the subject: Conditional comments, which could be helpful for your scenario?

You can see how to implement a content filter in RadEditor for ASP.NET AJAX in this live example: Custom Content Filters.

Greetings,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Matej
Top achievements
Rank 1
answered on 19 Dec 2008, 01:36 PM
Thank you for the reply. I tried the solution and implemented the
Content filter which removes the comments. However both IE
and FF returned an error in the OnClientLoad event handler.
Both complained that FiltersManager ( editor.FiltersManager.Add(customFilter)
property is undefined. I followed both steps to create a content filer (write a javascript
function/class which sets all three methods for a filter and add this class in the FilterManager
 in the OnClientLoad event handler) and and i am still unable to make it work. 
Am i doing something wrong?
0
Accepted
Rumen
Telerik team
answered on 22 Dec 2008, 02:46 PM
Hi Borut,

Please, try this content filter:

 <telerik:radeditor runat="server" ID="RadEditor1" _OnClientLoad="OnClientLoad">
        <Content>
            <strong><br />&nbsp;<!--[anything]-->Switch to Html mode to <!--[if supportFields]--> run<!--[endif]--> the content filter.<br />&nbsp;</strong>
        </Content>
    </telerik:radeditor>
    <script type="text/javascript">
    function OnClientLoad(editor, args)
    {
       editor.get_filtersManager().add(new MyFilter());
    }
    MyFilter = function()
    {
       MyFilter.initializeBase(this);
       this.set_isDom(false);
       this.set_enabled(true);
       this.set_name("RadEditor filter");
       this.set_description("RadEditor filter description");
    }
    MyFilter.prototype =
    {
       getHtmlContent : function(content)
       {
         var newContent = content;
         //Make changes to the content and return it
         newContent = newContent.replace(/<!--\[.*?\]-->/g,"");
         return newContent;
       },
      
       getDesignContent : function(content)
       {
         var newContent = content;
         //Make changes to the content and return it
         newContent = newContent.replace(/<!--\[.*?\]-->/g,"");
         return newContent;
       }
    }
    MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter);
    </script>

The filter applies to RadEditor for ASP.NET AJAX.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Matej
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Matej
Top achievements
Rank 1
Share this question
or