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")
  }
}

_______________________________________________
mozilla-editor mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-editor

Reply via email to