Topic: Waiting for LT editor to finish loading. (focus, end of content, etc.)


I want to focus the LanguageTool editor, move the cursor to end of content, maybe restore the cursor position, and possibly other things, that require the editor to finish the "Check Text" operation before they will work. How can I make the script wait for that to happen or use a dynamic setTimeout etc with TinyMCE or LT. I am using the basic web page code supplied by LanguageTool.org.

This is what I am using now. I would prefer a way that is self-contained in my mydoit()

function mydoit() {
var langCode = document.checkform.lang.value;
tinyMCE.activeEditor.execCommand("mceWritingImprovementTool", langCode);

//run commands only after the editor is finished loading.
//2000 (2 seconds) is arbitrary and only works about half of the time.
setTimeout(function() { tinyMCE.get("checktext").focus(); }, 2000);

//this focuses and moves cursor to end of content using a goToTheEnd() function.
//setTimeout(function() { tinyMCE.get("checktext").focus(); goToTheEnd(); }, 2000);

I am mostly using IE11 with TinyMCE version 3.5.6 which is what they use, and I have
not been able to use a more recent version of TinyMCE, although I would very much
like to.