This returns true for me, so I would guess that it should work.
This on the other hand:
textarea.controllers.getControllerForCommand('cmd_insertText').doCommand('cmd_insertText','hallo');
returns an error for me:
Error: uncaught exception: [Exception... "Component returned failure
code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIController.doCommand]"
nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame
:: chrome://findtextarea/content/findtextareadialog.js ::
replacetextarea :: line 130" data: no]
What am I doing wrong?
-Martijn
Hmm, according to this:
http://lxr.mozilla.org/seamonkey/source/editor/libeditor/base/nsEditorCommands.cpp#711
it is not implemented. Am I right?
Is there any other way to insert text directly into a textarea without
using textarea.value?
Hmm, found an (ugly) workaround:
I misuse the clipboard functions:
http://www.xulplanet.com/tutorials/xultu/clipboard.html
and cmd_paste seems to work for textareas:
textarea.controllers.getControllerForCommand('cmd_paste').doCommand('cmd_paste');
Well, all this would not be necessary if this bug would be fixed:
http://bugzilla.mozilla.org/show_bug.cgi?id=158071
-Martijn