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();
      editor.beginTransaction();

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

      editor.endTransaction();

  } catch (e) {
      console.log(e);
      return false;
  }

I am trying to find documentation on this page: https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Thunderbird_extensions/Building_a_Thunderbird_extension but no luck so far, a lot of broken links and out of date information.

Thanks,
André

This addon development forum is more active: https://thunderbird.topicbox.com/groups/addons

Thank you. I will try.