How can I access and modify the content of the editor?

I am porting a plugin to Thunderbird 68 (Highlighter), that modifies the content of the HTML inside the email composer.

Where can I find a reference page to do that, please?

So far, I am trying just some sample code, but nothing happens when the function is called.

  var msg_compose_window = document.getElementById("msgcomposeWindow");
  var msg_type = msg_compose_window.getAttribute("msgtype");

  try {
      var editor_type = GetCurrentEditorType();
      if (! (editor_type == "html" || editor_type == "htmlmail")) return;

      var editor = GetCurrentEditor();

      var body = editor.outputToString('text/html', 2);
      body = body.replace("ipsum", "<b>ipsum</b>");


  } catch (e) {
      return false;

I am trying to find documentation on this page: but no luck so far, a lot of broken links and out of date information.


This addon development forum is more active:

Thank you. I will try.