To be able to complete my Wordpress Wordpress plugin I wish to make tinyMCE to change from a custom Tag (Somedatahere) along with a corresponding Image Display within the WYSIWYG-View.

The big event ought to be triggered on load, safe, autosave, switch view etc. Threre are 4 different occasions defined, but not one of them works not surprisingly.

  1. onBeforeSetContent
  2. onGetContent
  3. onPostProcess
  4. onLoadContent

.

ed.onPostProcess.add(function(ed, o) {
    if (o.set){
       o.content = t._htmlToWysiwyg(o.content, url);
    }
    if (o.get){
       o.content = t._wysiwygToHtml(o.content, t);
    }
});

Anyon know the proper way?

I don't understand what you anticipate some different occasions is going to do (?), but i can tell some problems inside your code.

1. The item o doesn't contain fields get and set - so o.get and o.set should never be true! Thus your code should never be known as.

2. You're while using variable url, but that one isn't defined here.

Working example: You might attempt to paste a string that contains "a" in to the editor. Make use of the following:

ed.onPostProcess.add(function(ed, o) {
    //console.log('o:', o);
    o.content = o.content.replace(/a/g, "A");
});

You need to observe that all lower 'a's get changed by 'A's.