This must be simple but...

  •  07-15-2008, 12:05 AM

    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


View Complete Thread