Re: Is there a way I can save and restore the cursor position?

  •  04-03-2009, 10:58 AM

    Re: Is there a way I can save and restore the cursor position?

    Thanks for the quick reply Adam.
     
    As you know, PasteHTML() places the content at the cursor location, or overwrites any selected content. I was hoping to use the CuteEditor_OnChange event to execute a custom HTML filter when any content changed, and do it on the fly while the user is typing. This means I need to get the entire HTML and filter it, not ask the user to select content then filter it, then put the entire HTML back in the editor and overwrite all the orignal HTML content in the process.
     
    The custom filter finds formatting problems that my CMS doesn't like and changes or removes them. Is there a better way to do what I need to do? My code now looks like this:
     
        function CuteEditor_OnChange(editor)
        {    
            // retrieve the content
            var content = editor.getHTML();

             // Filter the content
             content = custom_filter( content );

            // set the content
            editor.setHTML( content );
        }

    If I can't do the filtering on the fly, then my alternative is to run the custom filter when the content is previewed or saved.
     
    Thanks for any advice.
    Jeff
     
View Complete Thread