cmd_insertText Function Problem, please help!

"Sekmet" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.editor
Organization http://groups.google.com
Message-ID <[email protected]>
I`m writing a extension to mozilla and using function bellow to insert
text on document.
Works very well, but i would like know if is possible select the
location where to insert text.
Function bellow insert some text at cursor position only.
Can Someone help me with this? or tell me if is possible do this?

Thanks in advance
Best Regards
Carlos


function insertText(aText) {
  try {
    var command = "cmd_insertText";
    var controller =
document.commandDispatcher.getControllerForCommand(command);
    if (controller && controller.isCommandEnabled(command)) {
      controller =
controller.QueryInterface(Components.interfaces.nsICommandController);
      var params =
Components.classes["@mozilla.org/embedcomp/command-params;1"];
      params =
params.createInstance(Components.interfaces.nsICommandParams);
      params.setStringValue("state_data", aText);
      controller.doCommandWithParams(command, params);
    }
  }
  catch (e) {
    dump("Can't do cmd_insertText! ");
    dump(e+"\n")
  }
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.