This must be simple but...

Last post 07-18-2008, 7:17 PM by zaggle. 5 replies.
Sort Posts: Previous Next
  •  07-15-2008, 12:05 AM 42219

    This must be simple but...

    I can't quite figure it out, and would appreciate someone telling me if it can be done..
     
    I have a custom function which removes unesessary html characters, (the built in ones have a number of issues, and I need to filter some specific tags). Currently I have added a new button to the toolbar, that the user can click but this happens after the user has pasted in the text. However my preferred solution would be to attach the function to the paste so that the text is cleaned before it ends up in the editor, which would also be seemless to the user.
     
    I have tried to trap it using the CuteEditor_OnCommand() function:
     
    if (command=="Paste")
                  {   
                  var editor1 = document.getElementById('ce');
                
                  var editdoc=editor1.GetDocument();
              
                  var editselection=editor1.getHTML();
     
    this would be ideal but the html is not present at that time.
     
    As an alternate I used the CuteEditor_FilterHTML(editor,str) function, this works great but I have to refresh the control before the result shows, i.e. switch from normal tab to html tab and then back again. I tried setActiveTab('Code') and then setActiveTab('Edit'), it switched to code ok but back to edit. I can't seem to figure out how to refresh it simply.

    Am I missing something simple. I just want to trap pasted text, strip it of unwanted characters before it hits the screen...
     
    help please..
     
    Thanks


  •  07-15-2008, 4:58 PM 42238 in reply to 42219

    Re: This must be simple but...

    surely I can't be the only one who has attempted to do this!!
  •  07-17-2008, 4:15 PM 42319 in reply to 42219

    Re: This must be simple but...

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

    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:48 PM 42336 in reply to 42319

    Re: This must be simple but...

    Adam
     
    These forum answers are getting very frustrating, with a lot of going back and forward and totally missing the point of the question...
     
    ... this does not even begin to answer, because I am not having an issue with getting the editor instance... you have picked up on an insignificant point and for some reason, totally ignored the real substance of the question... sorry to be a pain, but what's the point in a forum if the host cannot see the problem.
     
    I only put 'ce' there to indicate the cute editor instance, in fact <%= Editor1.ClientID%>  would not work for me because I am retrieving the editor instance from within a gridview were there are multiple instances and the active one has to be selected, but as I said that's not my issue. MY QUESTION is centered on applying custom functionality to pasted text so as to strip out unwanted html, but I don't seem to be getting anywhere...
     
    see related posts:
     
    http://cutesoft.net/forums/thread/42125.aspx
    http://cutesoft.net/forums/thread/42223.aspx
    http://cutesoft.net/forums/thread/42172.aspx
     

    cheers
     

  •  07-18-2008, 2:43 PM 42357 in reply to 42336

    Re: This must be simple but...

    You can overwrite any command of Cute Editor.
     
    Demo:
     
     
    If you want to overwrite the paste command.
     
    You can add the following code in the bottom of your page:
     
    <script>
    function CuteEditor_OnCommand(editor,command,ui,value)
    {
     //handle the command by yourself
     if(command.toLowerCase()=="paste")
     {
      alert("handle the paste command");
      return true;//return true if you want to stop the command
     }
    }
    </script>

    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-18-2008, 7:17 PM 42361 in reply to 42357

    Re: This must be simple but...

    I give up
View as RSS news feed in XML