EditorOnPaste="PasteWord" differences from your sample

Last post 07-20-2008, 10:06 PM by zaggle. 16 replies.
Sort Posts: Previous Next
  •  07-10-2008, 10:53 PM 42125

    EditorOnPaste="PasteWord" differences from your sample

    Hi

    I am referring to another post, (which as usual on this forum left me answer less), check out  http://cutesoft.net/forums/thread/41981.aspx. I have an issue with EditorOnPaste="PasteWord" also, where the input differs from your sample page, http://cutesoft.net/example/editor-onpaste.aspx where you sent the other that user. Your sample demonstrates stripping word characters from pasted in Word text and from what I see it works verily well. However in my experience, the result is different.
     
    Sample Text:

    This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc.

    1. Test1
    2. Test2
    3. Test3

    Html from your sample, (I get this by selecting the html button)
     
    <p><span style="font-size: 10pt; font-family: Arial;">This si a <strong>tesat</strong> doc. This si a <em>tesat</em> doc. This si <u>a tesat doc. This si a tesat doc</u>. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. </span></p>
    <p>&nbsp;</p>
    <ol style="margin-top: 0in;" start="1" type="1">
         <li><span style="font-size: 10pt; font-family: Arial;">Test1</span></li>
         <li><strong><span style="font-size: 10pt; font-family: Arial;">Test2</span></strong></li>
         <li><span style="font-size: 10pt; font-family: Arial;">Test3</span></li>
    </ol>
     
    Html on my page:
     
    <p style="margin: 0in 0in 0pt"><span style="font-size: 10pt; font-family: Arial">This si a <strong>tesat</strong> doc. This si a <em>tesat</em> doc. This si <u>a tesat doc. This si a tesat doc</u>. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. This si a tesat doc. </span></p>
    <p style="margin: 0in 0in 0pt">&nbsp;</p>
    <ol style="margin-top: 0in" type="1">
        <li style="margin: 0in 0in 0pt"><span style="font-size: 10pt; font-family: Arial">Test1</span></li>
        <li style="margin: 0in 0in 0pt"><strong><span style="font-size: 10pt; font-family: Arial">Test2</span></strong></li>
        <li style="margin: 0in 0in 0pt"><span style="font-size: 10pt; font-family: Arial">Test3</span></li>
    </ol>
     
    Could you please tell me whats causing the differences, mainly the "<p style="margin: 0in 0in 0pt">" in this example but many other differences in other examples. I want to be able to strip out all the word stuff on paste not just inconsistent bits and pieces. 
     
    I am using 6.1, with IE 7
     
    Thanks
  •  07-11-2008, 11:31 AM 42141 in reply to 42125

    Re: EditorOnPaste="PasteWord" differences from your sample

  •  07-11-2008, 7:23 PM 42160 in reply to 42141

    Re: EditorOnPaste="PasteWord" differences from your sample

    Adam
     
    Don't you think it is just good business sense to inform your clients of changes you made to the control, as far as I can see there is still no account on the website of the differences between 6 and 6.1. Refer to my previous post http://cutesoft.net/forums/thread/41295.aspx. Now you are telling me that you have updated 6.1 since you first made it available, but there is no build version and again no accounting of the differences between builds. I spent hours trying to reconcile pasted differences that you are now telling me have already been fixed...
     
    do you see my point? the least you could do is email each of your clients to inform of a build update whenever you make a change... very frustrating...
     
    Zaggle
  •  07-11-2008, 9:41 PM 42161 in reply to 42160

    Re: EditorOnPaste="PasteWord" differences from your sample

    Zaggle,

     
    We will create a new thread showing details when we make changes. Sorry for the inconvenience.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-13-2008, 5:08 AM 42171 in reply to 42161

    Re: EditorOnPaste="PasteWord" differences from your sample

    Thanks Adam that will be very helpful
     
    Cheers
     

  •  07-13-2008, 7:59 PM 42178 in reply to 42171

    Re: EditorOnPaste="PasteWord" differences from your sample

    downloaded the new version, there is no difference, still showing the 
     
    <p style="margin: 0in 0in 0pt">
     
    but as I said before your sample is not, also there is no differences in the dll's from the version I had before.
     
     
     

  •  07-13-2008, 10:21 PM 42181 in reply to 42178

    Re: EditorOnPaste="PasteWord" differences from your sample

    zaggle,
     
    Have you updated the client files as well?
     
    Keep me posted

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-14-2008, 2:43 AM 42186 in reply to 42181

    Re: EditorOnPaste="PasteWord" differences from your sample

     
    Yes Adam
     
    I have replaced all files dll's and client, still the same result -"margin: 0in 0in 0pt" still appearing in many places.
     
    Two other points around this issue:
     
    1. When I paste in from Word the first time it looks fine, but if I paste in again to the same instance of CE, 3 <p>&nbsp;</p> are added to the top of the text. This does not happen in your sample. Why is it happening on mine?????
     
    2. Today I discovered the javascript script filter function "CuteEditor_FilterHTML(editor,wordContent)", which would solve a lot of my problems if I could apply it before pasted text appears in the editor. Currently it works but the result is only seen after the instance is refreshed.
     
    Thanks for your help
     
    Cheers
     

  •  07-14-2008, 2:48 AM 42187 in reply to 42186

    Re: EditorOnPaste="PasteWord" differences from your sample

    Just FYI
     
    I should add. my current settings.
     
    <CE:EDITOR id="Editor1" runat="server" Height="150px" width="600px"
                                                    text='<%# bind("comment") %>'
                                                    EnableContextMenu="True"
                                                    MaxTextLength = "8000"    
                                                    ContextMenuMode = "Simple"
                                                    Focus="False"
                                                    EditorWysiwygModeCss="../CSS/CuteEditorTextArea.css"                                                
                                                    EditorOnPaste="PasteWord"
                                                    ShowHtmlMode="true"
                                                    ShowEditMode="true"
                                                    ShowCodeViewToolBar="false"
                                                    ShowPreviewMode="false"
                                                    ShowTagSelector="false"
                                                    ShowDecreaseButton="false"
                                                    ShowGroupMenuImage="false"
                                                    ShowBottomBar="true"
                                                    ShowWordCount="true"
                                                    TemplateItemList="[Bold,Italic,Paste,InsertOrderedList,InsertUnOrderedList,Undo,Redo,ToFullPage,FromFullPage,NetSpell]"
                                                    ResizeStep="150"
                                                    BreakElement="P"
                                                    UseHttpHandlerCacheImages ="true"
                                                    EnableViewState ="false"
                                                    UsePhysicalFormattingTags="true"
                                                    DisableAutoFormatting="true">
                                                    
                                                    <FrameStyle BackColor="White"
                                                                BorderStyle="Solid"
                                                                Width="100%"
                                                                Height="100%"
                                                                CssClass="CuteEditorFrame"
                                                                BorderWidth="1px"
                                                                BorderColor="#DDDDDD">
                                                    </FrameStyle>
                                                                                  
                                                </CE:EDITOR>

    I have discovered that the number 1. issue is due to the EditorOnPaste="PasteWord" if I set it to "Default" it's fine,
    MS Word is the cause of all my ills...
  •  07-17-2008, 5:03 PM 42326 in reply to 42187

    Re: EditorOnPaste="PasteWord" differences from your sample

  •  07-17-2008, 6:29 PM 42330 in reply to 42326

    Re: EditorOnPaste="PasteWord" differences from your sample

    No I cannot, but do you have EditorOnPaste set to PasteWord, I noticed it doesn't happen when the setting is on Default, but only on PasteWord.
     
    However it doesen't matter much aynmore as I'm using Default with a custom paste word function
     
    Cheers
     
     
  •  07-17-2008, 6:52 PM 42332 in reply to 42330

    Re: EditorOnPaste="PasteWord" differences from your sample

    In the above example, EditorOnPaste is set to ConfirmWord.
     
    Please check this example:
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-17-2008, 9:18 PM 42335 in reply to 42332

    Re: EditorOnPaste="PasteWord" differences from your sample

    Do not know I can tell which EditorOnPaste setting it is set to, anyhow it doesn't really matter. As you can see from my other posts I have been struggling with issue and none of the EditorOnPaste settings are gonna meet my needs.
     
    The problem is mainly that none of the options handles the mismash of word versions and word options and settings that I have to deal with for my clients. So as I have said in other posts I have my own function which I would like to run on EditorOnPaste, so it would be great if I could run a custom function instead of having to mess around with the options that nearly but don't do the specific job I need. It would make your life easier as well but this is a common topic in the forum.
     
    But at the moment I cannot run a custom function, so I have to look at other options like running the function on paste, which as you might know from my other posts, I am finding impossible to implement.
     
    1. I tried a custom button on the tool bar, but it doesn't display in Firefox, I can't figure out why yet.... see  http://cutesoft.net/forums/thread/42223.aspx

    2. I would not need a button if I could clean the clipboard data on paste, so as I said above, the best would be to allow a custom function in EditorOnPaste, see http://cutesoft.net/forums/thread/42172.aspx,
    but it seems I keep getting half answers, which are coveralls taken from the documentation, which I have already tried and which for some reason or other are not adequate...
     
    as in your reply to that thread....
     
     
    /**********************
    You need to Retrieve Data from the Clipboard first then use the editor1.PasteHTML function.
     
    PasteHTML()

     

    This method is used for pasting the specified HTML into a range within an editor document. If anything is selected, the selection is replaced with the new HTML and text.

    Example:

    // get the cute editor instance
    var editor1 = document.getElementById('<% = Editor1.ClientID%>');

    // pasting the specified HTML into a range within a editor document
    editor1.PasteHTML("Hello World");

    ***********************/ 
     
    this is fine, but...
     
    I have already been there and could not get it to work...
    First question, how do I retrieve Data from the clipboard (Data as in html), if I use clipboardData.getData('Text­ ') I can get the text, but it's just text there is no html to clean, so by the time it's pasted the html is just the same. Is there some way that you know to do this?
     
    Second, using Ctrl + V does not work with method, which alienates at least 90% of my clients.

    This is what I am doing...
     
    function CuteEditor_OnCommand(editor,command,ui,value)
                {
                    //handle the command by yourself
                    
                    flagFormChanged('<%=formChanged.ClientID%>');   
                    
                    if (command=="Paste")
                    {   
                     
                        var editor1 = document.getElementById(editor.id);
                        var selectedHtml = clipboardData.getData('Text');
                       
                        editor1.PasteHTML(cleanWordPaste(selectedHtml));
                    
                    }              
                }
     
    This all works fine, except the clipboardData.getData('Text'); only provides text not html and it does not work with Ctrl+V in IE, in firefox it does not work with Ctrl+V or the context menu, only edit paste from the firefox main menu.... it's one issue after another...@#$% and a lot of time wasted
     
    So I would appreciate it if you could show me how to implement a complete solution which allows me to run my cleanWordPaste() function on paste, before it hits the screen using both Ctrl+V and the context menu (or if Ctrl+V cannot be used then a solution on how to disable the Ctrl+V). You must know how to do it because you are doing exactly that with your EditorOnPaste functionality.
     
     
     
    Cheers
     

  •  07-18-2008, 7:36 AM 42342 in reply to 42330

    Re: EditorOnPaste="PasteWord" differences from your sample

    why not try?
     
    function CuteEditor_OnCommand(editor,command,ui,value) {
      if (command=="Paste") {   
        var oEditor = document.getElementById(editor.id);
        var sHTML = oEditor.getHTML();
     
        //Parse HTML and Clean
        sHTML = sHTML.replace('<br />', '</p><p>');
     
        oEditor.setHTML(sHTML);
      }              
    }
  •  07-18-2008, 7:27 PM 42362 in reply to 42342

    Re: EditorOnPaste="PasteWord" differences from your sample

    Thanks Ady for reading my lengthy post and posting a somewhat helpful reply, but I have written somewhere before (lost track of the posts now) that I have tried this, but the problem is that, at the paste command time the editor instance does not yet have the data, getHTML(); returns "", the dat has not not yet left the clipboard, which I can get with clipBoard.getData('Text'), but this is of course not html. If I could figure out ow to get the html tp parse the rest is easy, but.... this is programming
     
    I am temporarily giving up with this issue, and am running it from a custom button on the tool bar, I have managed to figur out why the buttons were not appearing FF, it was because I was referencing the button gif location with \ instead of / this worked in ie but not ff, switching from \ to / works in both.
     
    Cheers 
  •  07-19-2008, 2:50 AM 42365 in reply to 42362

    Re: EditorOnPaste="PasteWord" differences from your sample

    Hi zaggle,
     
    In which case you'll need to execute the paste command yourself then tell cuteeditor that you have done this. e.g.
     
    function CuteEditor_OnCommand(editor,command,ui,value) {
      if (command=="Paste") {   
        var oEditor = document.getElementById(editor.id);
        var oSelection = oEditor.GetSelection();
        var oRange = oSelection.createRange();
     
        //DHTML Paste Command.
        oRange.execCommand("Paste");
     
        var sHTML = oEditor.getHTML();
     
        //Parse HTML and Clean
        sHTML = sHTML.replace('<br />', '</p><p>');
     
        oEditor.setHTML(sHTML);
     
        //Tell CuteEditor Paste handled
        return true;
      }              
    }
     
    BTW, this code only works for IE, firefox needs different code (I think).
     
    Many Thanks,
    Ady
  •  07-20-2008, 10:06 PM 42386 in reply to 42365

    Re: EditorOnPaste="PasteWord" differences from your sample

    Thank you Ady
     
    this was exactly the answer I was looking for,
     
    you are right it doesn't work on FF, but I'm sure I can get that sorted
     
    Cheers
     

View as RSS news feed in XML