weird behaviour on pasting the word content to mozilla

3 posts, 0 answers
  1. Karthik
    Karthik avatar
    2 posts
    Member since:
    Oct 2013

    Posted 04 Oct 2013 Link to this post

    Hi,

    I've encountered a problem recently when a text is copied from MSWORD to telerik editor. This behaviour is only observed in Mozilla.

    I've created a table in msword and copied the table to the telerik rad editor. So, when table is copied i've observed that an additional tag in style called "border-image:none" is being displayed. This is only displaying in Mozilla, where as in Chrome the tag is not visible when pasted the same content. The content from this editor is being validated against a dtd. So, the process fails because of the border-image tag

    Finally i got up to the demos of telerik site to make sure if this thing is working or not. I've copied the same table from word to the demos page in telerik site i've observed that the tag is being visible for Mozilla firefox even in the telerik site.

    Create a table as is in the sample.png image that i've atattched in this post. Now open mozilla browser and chrome browser copy the following url:

    http://demos.telerik.com/aspnet-ajax/editor/examples/cleaningwordformatting/defaultcs.aspx

    Now paste the created table in to the editors of both the browsers. Also i've atattched the screenshots for both the browsers.

    Can anyone please suggest any approach for doing this.

    Thanks
  2. Ianko
    Admin
    Ianko avatar
    1956 posts

    Posted 08 Oct 2013 Link to this post

    Hello Karthik,

    I can verify that the described issue is a bug. I am logging it in our system for fixing, nevertheless I cannot provide an estimation when it will be fixed. You could follow this feedback portal to track its status, vote or comment.

    As a token of gratitude I am updating your Telerik points for this report.

    I can suggest using a custom script that strips the additional attribute from the content. Please follow this example setup for your project:
    <telerik:RadEditor runat="server" ID="RadEditor1" OnClientPasteHtml="OnClientPasteHtml">
    </telerik:RadEditor>
     
    <script type="text/javascript">
        function OnClientPasteHtml(editor, args) {
            var text = args.get_value();
            text = text.replace(/border-image: none;\s?/gi, "");
            args.set_value(text);
        }
    </script>

    Note that if you set the ContentAreMode="Div" you will not be able to use the OnClientPasteHtml event. In this case I suggest building a custom content filter with this logic. 

    Regards,
    Ianko
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. Karthik
    Karthik avatar
    2 posts
    Member since:
    Oct 2013

    Posted 08 Oct 2013 Link to this post

    Hello Ianko,

    Thanks for the reply.

    I've even did the same to resolve that issue few days earlier although it's just a workaround and forgot to update the same on the forum.
    I just got a notification today as you have replied to this thread.

    Thanks,
    Karthik
Back to Top