1

Topic: Tracking Changes / Highlighting Characters

Hi,
I'm trying to implement a simple change tracking plugin.
One of it's features is to highlight / format deleted text, without deleting it from the editor.

To realize that I added custom code as follows - but I'm still missing a proper solution for applying a custom formating to the cursor's next character.

   ed.onKeyDown.addToTop(function(ed, e) {       
    // handle delete
    if(e.keyCode == 46){
            // DO HIGHLIGHTING...
           return false;

Can anyone help me out with that - any suggestions - any ideas?

Thanks!

2

Re: Tracking Changes / Highlighting Characters

Maybe ICE could be of usage here:
http://open.blogs.nytimes.com/2012/01/2 … web-first/

Also applying formatting to things you delete is somewhat tricky since you need to walk the dom from where the caret is and look for text nodes. For example a backspace on this code.
<b><i>text</i></b>|text would have to apply the <del> here: <b><i>tex<del>|t</del></i></b>text.

You can do this by using a range and then a tinymce.dom.TreeWalker to walk left/right.

Best regards,
Spocke - Main developer of TinyMCE